Documentation ¶
Index ¶
- func AddMarkerWhere(qs *string, opts *pb.SearchOptions, alias string, includeAnd bool, ...)
- func AddOrderBy(qs *string, opts *pb.SearchOptions, alias string)
- func InParamString(numArgs int) string
- func IsDuplicateKey(err error) bool
- func IsDuplicateKeyOn(err error, constraintName string) bool
- func NormalizeSortFields(opts *pb.SearchOptions, sortFieldInfos *[]*SortFieldInfo) error
- func Ping(db *sql.DB, connectTimeout time.Duration) error
- type SortFieldInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMarkerWhere ¶
func AddMarkerWhere( qs *string, opts *pb.SearchOptions, alias string, includeAnd bool, qargs *[]interface{}, infos []*SortFieldInfo, markerLookup func() string, )
Examines the supplied search options and injects a WHERE clause that filters a page of results based on a marker value and the sort direction requested. The DB field we winnow is always the uuid field (which is what the marker contains.
func AddOrderBy ¶
func AddOrderBy(qs *string, opts *pb.SearchOptions, alias string)
Extends the supplied raw SQL string with an ORDER BY clause based on a pb.SearchOptions message and a table alias
func InParamString ¶
Returns a string containing the expression IN with one or more question marks for parameter interpolation. If numArgs argument is 3, the returned value would be "IN (?, ?, ?)"
func IsDuplicateKey ¶
Returns true if the supplied error represents a duplicate key error
func IsDuplicateKeyOn ¶
Returns true if the supplied error is a duplicate key error and the supplied constraint name is the one that was violated
func NormalizeSortFields ¶
func NormalizeSortFields( opts *pb.SearchOptions, sortFieldInfos *[]*SortFieldInfo, ) error
Looks through any requested sort fields and validates that the sort field is something we can sort on, replacing any aliases with the correct database field name. Returns an error if any requested sort field isn't valid.