-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_load.go
19 lines (16 loc) · 954 Bytes
/
search_load.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package dynamodb
import (
"context"
"github.com/aws/aws-sdk-go/service/dynamodb"
"reflect"
)
func NewSearchLoaderWithQuery(db *dynamodb.DynamoDB, tableName string, modelType reflect.Type, partitionKeyName string, sortKeyName string, buildQuery func(interface{}) (dynamodb.ScanInput, error), options ...func(context.Context, interface{}) (interface{}, error)) (*Searcher, *Loader) {
loader := NewLoader(db, tableName, modelType, partitionKeyName, sortKeyName)
searcher := NewSearcherWithQuery(db, modelType, buildQuery, options...)
return searcher, loader
}
func NewSearchLoader(db *dynamodb.DynamoDB, tableName string, modelType reflect.Type, partitionKeyName string, sortKeyName string, search func(context.Context, interface{}, interface{}, int64, ...int64) (int64, string, error)) (*Searcher, *Loader) {
loader := NewLoader(db, tableName, modelType, partitionKeyName, sortKeyName)
searcher := NewSearcher(search)
return searcher, loader
}