database

package
v0.0.0-...-05665eb Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneDB

func CloneDB(db *gorm.DB) *gorm.DB

func ConnectDatabase

func ConnectDatabase[T any](dsn string, model *T, TableName string, debug bool) (*gorm.DB, error)

func CreateItems

func CreateItems[T any](db *gorm.DB, model *T, items []*T) ([]uint, error)

func DeleteItems

func DeleteItems[T any](db *gorm.DB, model *T, ids []uint) error

func FindByIDs

func FindByIDs[T any](db *gorm.DB, model *T, ids []uint) ([]map[string]any, error)

func FindItems

func FindItems[T any](db *gorm.DB, limit int, page int, model *T, query map[string]any, order string, direction string) ([]map[string]any, error)

func GetItem

func GetItem[T any](db *gorm.DB, model *T, id uint) (map[string]interface{}, error)

func JSONGetID

func JSONGetID[T any](obj *T) uint

func MapToStruct

func MapToStruct[T any](m map[string]any) *T

func StructToMap

func StructToMap[T any](obj *T) map[string]any

func UpdateItem

func UpdateItem[T any](db *gorm.DB, model *T, item map[string]any, id uint) error

func UpsertItem

func UpsertItem[T any](db *gorm.DB, model *T, item map[string]any, id uint) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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