Skip to content

Commit

Permalink
Support static increment value (#38)
Browse files Browse the repository at this point in the history
* Support static increment value

* Pass Increment on beginning transaction
  • Loading branch information
Fs02 committed Aug 20, 2022
1 parent 93e7ae9 commit 2a66d51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type SQL struct {
DeleteBuilder DeleteBuilder
TableBuilder TableBuilder
IndexBuilder IndexBuilder
Increment int
IncrementFunc IncrementFunc
ErrorMapper ErrorMapper
DB *sql.DB
Expand Down Expand Up @@ -101,6 +102,7 @@ func (s SQL) Begin(ctx context.Context) (rel.Adapter, error) {
DeleteBuilder: s.DeleteBuilder,
TableBuilder: s.TableBuilder,
IndexBuilder: s.IndexBuilder,
Increment: s.Increment,
IncrementFunc: s.IncrementFunc,
ErrorMapper: s.ErrorMapper,
Tx: tx,
Expand Down Expand Up @@ -226,7 +228,7 @@ func (s SQL) InsertAll(ctx context.Context, query rel.Query, primaryField string

var (
ids = make([]interface{}, len(bulkMutates))
inc = 1
inc = s.Increment
)

if s.IncrementFunc != nil {
Expand Down

0 comments on commit 2a66d51

Please sign in to comment.