77 "strings"
88
99 squirrel "github.com/Masterminds/squirrel"
10+ "github.com/contiamo/go-base/pkg/db"
1011 dserrors "github.com/contiamo/go-base/pkg/errors"
1112 uuid "github.com/satori/go.uuid"
1213)
@@ -16,11 +17,11 @@ type IDResolver interface {
1617 // Resolve returns an ID of the given record identified by the value which can be either
1718 // an UUID or a unique string value of the given secondary column.
1819 // where is a map of where statements to their list of arguments
19- Resolve (ctx context.Context , sql squirrel. StatementBuilderType , value string , filter squirrel.Sqlizer ) (string , error )
20+ Resolve (ctx context.Context , sql db. SQLBuilder , value string , filter squirrel.Sqlizer ) (string , error )
2021 // Sqlizer returns a Sqlizer interface that contains where statements for a given
2122 // filter and the ID column, so you can immediately use it with
2223 // the where of the select builder
23- Sqlizer (ctx context.Context , sql squirrel. StatementBuilderType , value string , filter squirrel.Sqlizer ) (squirrel.Sqlizer , error )
24+ Sqlizer (ctx context.Context , sql db. SQLBuilder , value string , filter squirrel.Sqlizer ) (squirrel.Sqlizer , error )
2425}
2526
2627// NewIDResolver creates a new name->id resolver for a table, for example
@@ -42,7 +43,7 @@ type idResolver struct {
4243 secondaryColumn string
4344}
4445
45- func (r * idResolver ) Sqlizer (ctx context.Context , sql squirrel. StatementBuilderType , value string , filter squirrel.Sqlizer ) (squirrel.Sqlizer , error ) {
46+ func (r * idResolver ) Sqlizer (ctx context.Context , sql db. SQLBuilder , value string , filter squirrel.Sqlizer ) (squirrel.Sqlizer , error ) {
4647 id , err := r .Resolve (ctx , sql , value , filter )
4748 if err != nil {
4849 return nil , err
@@ -60,7 +61,7 @@ func (r *idResolver) Sqlizer(ctx context.Context, sql squirrel.StatementBuilderT
6061 }, nil
6162}
6263
63- func (r * idResolver ) Resolve (ctx context.Context , sql squirrel. StatementBuilderType , value string , filter squirrel.Sqlizer ) (string , error ) {
64+ func (r * idResolver ) Resolve (ctx context.Context , sql db. SQLBuilder , value string , filter squirrel.Sqlizer ) (string , error ) {
6465 if value == "" {
6566 return value , dserrors.ValidationErrors {
6667 "id" : errors .New ("the id parameter can't be empty" ),
0 commit comments