Documentation
¶
Overview ¶
Package common contains utility methods used by all adapters.
Index ¶
- func DecodeUidString(str string) int64
- func DisjunctionSql(req [][]string, fieldName string) (string, []any)
- func EncodeUidString(str string) t.Uid
- func ExtractTags(update map[string]any) []string
- func FilterFoundTags(setTags t.StringSlice, index map[string]struct{}) []string
- func FromJSON(src any) any
- func RangesToSql(in []t.Range) (string, []any)
- func SelectEarliestUpdatedSubs(subs []t.Subscription, opts *t.QueryOpt, maxResults int) []t.Subscription
- func SelectLatestTime(t1, t2 time.Time) time.Time
- func ToJSON(src any) []byte
- func UpdateByMap(update map[string]any) (cols []string, args []any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeUidString ¶ added in v0.24.1
DecodeUidString takes UID as string, converts it to int64 representation. UIDs are stored as decoded int64 values.
func DisjunctionSql ¶ added in v0.24.0
DisjunctionSql converts a slice of disjunctions to SQL HAVING clause and arguments.
func EncodeUidString ¶ added in v0.24.1
EncodeUidString takes decoded string representation of int64, produce UID. UIDs are stored as decoded int64 values.
func ExtractTags ¶ added in v0.24.0
If Tags field is updated, get the tags so tags table cab be updated too.
func FilterFoundTags ¶ added in v0.24.0
func FilterFoundTags(setTags t.StringSlice, index map[string]struct{}) []string
FilterFoundTags keeps only those tags in setTags that are present in the index.
func RangesToSql ¶ added in v0.24.0
RangesToSql converts a slice of ranges to SQL BETWEEN or IN() constraint and arguments.
func SelectEarliestUpdatedSubs ¶
func SelectEarliestUpdatedSubs(subs []t.Subscription, opts *t.QueryOpt, maxResults int) []t.Subscription
SelectEarliestUpdatedSubs selects no more than the given number of subscriptions from the given slice satisfying the query. When the number of subscriptions is greater than the limit, the subscriptions with the earliest timestamp are selected.
func SelectLatestTime ¶ added in v0.18.0
SelectLatestTime picks the latest update timestamp out of the two.
Types ¶
This section is empty.