db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string) *gorm.DB

func Register

func Register(c map[string]Config)

Types

type BaseModel

type BaseModel struct {
	ID        uint           `gorm:"primarykey;autoIncrement" json:"id"`
	CreatedAt *LocalTime     `json:"created_at"`
	UpdatedAt *LocalTime     `json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type Config

type Config struct {
	Dialect  string `mapstructure:"dialect" yaml:"dialect" json:"dialect"`
	Host     string `mapstructure:"host" yaml:"host" json:"host"`
	Port     int    `mapstructure:"port" yaml:"port" json:"port"`
	Username string `mapstructure:"username" yaml:"username" json:"username"`
	Password string `mapstructure:"password" yaml:"password" json:"password"`
	Database string `mapstructure:"database" yaml:"database" json:"database"`
	Params   string `mapstructure:"params" yaml:"params" json:"params"`
	ShowSQL  bool   `mapstructure:"show_sql" yaml:"show_sql" json:"show_sql"`
}

func (*Config) DSN

func (c *Config) DSN() string

type LocalTime

type LocalTime time.Time

func (*LocalTime) MarshalJSON

func (d *LocalTime) MarshalJSON() ([]byte, error)

func (*LocalTime) Scan

func (t *LocalTime) Scan(v any) error

func (LocalTime) Value

func (t LocalTime) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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