pgsql

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate added in v1.5.0

func AutoMigrate(table interface{}) error

AutoMigrate automatically migrates the given table.

func DB

func DB() *gorm.DB

func Init

func Init(cfg *Config) (err error)

func NewDBTable

func NewDBTable(name string) dbTable

Types

type Config

type Config struct {
	Host    string    `json:"host"     required:"true"`
	User    string    `json:"user"     required:"true"`
	Pwd     string    `json:"pwd"      required:"true"`
	Name    string    `json:"name"     required:"true"`
	Port    int       `json:"port"     required:"true"`
	Life    int       `json:"life"     required:"true"`
	MaxConn int       `json:"max_conn" required:"true"`
	MaxIdle int       `json:"max_idle" required:"true"`
	DBCert  string    `json:"db_cert"  required:"true"`
	Code    errorCode `json:"error_code"`
}

DbLife: the unit is minute

func (*Config) SetDefault

func (p *Config) SetDefault()

type Pagination

type Pagination struct {
	PageNum      int
	CountPerPage int
}

type SortByColumn

type SortByColumn struct {
	Column string
	Ascend bool
}

Jump to

Keyboard shortcuts

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