scopes

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedOrderByColumns = map[string]string{
	"ID":               "id",
	"CREATE_TIME":      "create_time_since_epoch",
	"LAST_UPDATE_TIME": "last_update_time_since_epoch",
	"id":               "id",
}

AllowedOrderByColumns contains allowed column names for orderBy to prevent SQL injection

View Source
var AllowedSortOrders = map[string]string{
	"ASC":  entity.SortOrderAsc,
	"DESC": entity.SortOrderDesc,
}

AllowedSortOrders contains allowed sort orders to prevent SQL injection

Functions

func CreateNextPageToken

func CreateNextPageToken(id int32, value any) string

func IsValidTablePrefix

func IsValidTablePrefix(tablePrefix string) bool

IsValidTablePrefix validates table prefix to prevent SQL injection

func Paginate

func Paginate(value any, pagination *entity.Pagination, db *gorm.DB) func(db *gorm.DB) *gorm.DB

func PaginateWithOptions

func PaginateWithOptions(value any, pagination *entity.Pagination, db *gorm.DB, tablePrefix string, customAllowedColumns map[string]string) func(db *gorm.DB) *gorm.DB

func PaginateWithTablePrefix

func PaginateWithTablePrefix(value any, pagination *entity.Pagination, db *gorm.DB, tablePrefix string) func(db *gorm.DB) *gorm.DB

Types

type Cursor

type Cursor struct {
	ID    int32
	Value string
}

func DecodeCursor

func DecodeCursor(token string) (*Cursor, error)

Jump to

Keyboard shortcuts

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