Skip to content

Commit

Permalink
🔥 clean: remove useless clone method
Browse files Browse the repository at this point in the history
  • Loading branch information
0xE8551CCB committed Oct 6, 2019
1 parent 429054a commit eef9d92
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions chell.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ func (c *Chell) dumpAsyncFields(ctx context.Context, dst *Schema, src interface{

for item := range items {
if item.err != nil {
cancel()
return item.err
}

err := c.dumpField(ctx, item.field, item.data)
if err != nil {
cancel()
return err
}
}
Expand Down Expand Up @@ -273,30 +271,21 @@ func (c *Chell) dumpMany(ctx context.Context, dst, src interface{}, onlyFields,
}

func (c *Chell) Only(fields ...string) *Chell {
cpy := c.clone()
filters, err := ParseFilters(fields)
if err != nil {
cpy.err = err
c.err = err
} else {
cpy.onlyFieldFilters = filters
c.onlyFieldFilters = filters
}
return cpy
return c
}

func (c *Chell) Exclude(fields ...string) *Chell {
cpy := c.clone()
filters, err := ParseFilters(fields)
if err != nil {
cpy.err = err
c.err = err
} else {
cpy.excludeFieldFilters = filters
}
return cpy
}

func (c *Chell) clone() *Chell {
return &Chell{
onlyFieldFilters: c.onlyFieldFilters,
excludeFieldFilters: c.excludeFieldFilters,
c.excludeFieldFilters = filters
}
return c
}

0 comments on commit eef9d92

Please sign in to comment.