common

package
v0.0.0-...-c1cd75e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CursorTimestampFormat = "2006-01-02 15:04:05.999999 -0700 MST"

Variables

This section is empty.

Functions

func EncodeCursor

func EncodeCursor(cursor DatetimeCursor) string

func StructToMap

func StructToMap(obj interface{}) map[string]interface{}

Types

type CursorPaginationInfo

type CursorPaginationInfo[DBType any] struct {
	Next string   `json:"next" serializer:"next"`
	Data []DBType `json:"data" serializer:"data"`
}

func Paginate

func Paginate[DBType any](settings SquirrelCursorPaginator[DBType], cursorString string) (*CursorPaginationInfo[DBType], error)

type DatetimeCursor

type DatetimeCursor struct {
	Value string `json:"value"`
	Id    uint   `json:"id"`
}

func DecodeCursor

func DecodeCursor(cursor string) (*DatetimeCursor, error)

type SquirrelCursorPaginator

type SquirrelCursorPaginator[DBType any] struct {
	Client          *sqlx.DB
	SelectBuilder   squirrel.SelectBuilder
	SortOrder       string
	SortColumn      string
	SortQueryPrefix string
	PageSize        int
}

Jump to

Keyboard shortcuts

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