db

package
v0.0.0-...-de38334 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB
View Source
var RedisClient *_redis.Client

RedisClient ...

Functions

func GetRedis

func GetRedis() *_redis.Client

GetRedis ...

func Init

func Init()

Init ...

func InitRedis

func InitRedis(selectDB ...int)

InitRedis ...

func Paginate

func Paginate(page *int, pageSize *int) func(db *gorm.DB) *gorm.DB

func Query

func Query(searchParams *SearchParams, additionalFilter map[string]any, model interface{}, count *int64) *gorm.DB

func QueryOne

func QueryOne(searchParams *SearchParams, additionalFilter map[string]any, model interface{}) *gorm.DB

func ResolveDB

func ResolveDB() (*gorm.DB, error)

Types

type SearchParams

type SearchParams struct {
	Filters  map[string]any `json:"$filters"`
	Page     int            `json:"$page"`
	PerPage  int            `json:"$per_page"`
	Sort     []string       `json:"$sort"`
	Populate []string       `json:"$populate"`
}

Jump to

Keyboard shortcuts

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