Documentation ¶
Index ¶
- func GormDBClose(gdb *gorm.DB) (err error)
- func GormFlip(tx *gorm.DB, pageSize, pageNo int) *gorm.DB
- func GormMultiEquals[T comparable](tx *gorm.DB, field string, values []T) *gorm.DB
- func GormMySQLConnect(dsn string, debug bool) (db *gorm.DB, err error)
- func GormMySQLIsNotFound(err error) bool
- func GormMySQLUniqueViolation(err error) bool
- func GormPgConnect(dsn string, debugMode bool) (db *gorm.DB, err error)
- func GormPgNotFound(err error) bool
- func GormPgUniqueViolation(err error) bool
- func MigratePgDir(dsn, migrations string) (err error)
- func MigratePgFs(dsn string, src embed.FS, subpath string) (err error)
- type Hashmap
- type PageResult
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GormDBClose ¶
func GormMultiEquals ¶
func GormMySQLConnect ¶
MySQL initialize
dsn format: {USERANME}:{PASSWORD}@tcp({IP})/{DATABASE}?charset=utf8mb4&parseTime=True&loc=Local
func GormPgConnect ¶
dsn format: - postgres://{USERANME}:{PASSWORD}@tcp({IP})/{DATABASE}?sslmode=disable - "host=%s port=5432 user=%s dbname=%s password=%s sslmode=disable TimeZone=Asia/Shanghai"
func GormPgNotFound ¶
func GormPgUniqueViolation ¶
!!! works as expected only version(gorm.io/driver/postgres) <= v1.4.5
and errors.Is(e, gorm.ErrDuplicatedKey) doesn't work as expected
func MigratePgDir ¶
Types ¶
type PageResult ¶
result
func NewPageResult ¶
func NewPageResult[T any]() *PageResult[T]
func (PageResult[T]) AsMap ¶
func (result PageResult[T]) AsMap() map[string]any
Click to show internal directories.
Click to hide internal directories.