common

package
v0.24.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package common contains utility methods used by all adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeUidString added in v0.24.1

func DecodeUidString(str string) int64

DecodeUidString takes UID as string, converts it to int64 representation. UIDs are stored as decoded int64 values.

func DisjunctionSql added in v0.24.0

func DisjunctionSql(req [][]string, fieldName string) (string, []any)

DisjunctionSql converts a slice of disjunctions to SQL HAVING clause and arguments.

func EncodeUidString added in v0.24.1

func EncodeUidString(str string) t.Uid

EncodeUidString takes decoded string representation of int64, produce UID. UIDs are stored as decoded int64 values.

func ExtractTags added in v0.24.0

func ExtractTags(update map[string]any) []string

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 FromJSON added in v0.24.0

func FromJSON(src any) any

Deserialize JSON data from DB.

func RangesToSql added in v0.24.0

func RangesToSql(in []t.Range) (string, []any)

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

func SelectLatestTime(t1, t2 time.Time) time.Time

SelectLatestTime picks the latest update timestamp out of the two.

func ToJSON added in v0.24.0

func ToJSON(src any) []byte

Convert to JSON before storing to JSON field.

func UpdateByMap added in v0.24.0

func UpdateByMap(update map[string]any) (cols []string, args []any)

Convert update to a list of columns and arguments.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL