database

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBMgr = manager{}

Functions

func Init added in v1.0.3

func Init()

func MysqlDialector

func MysqlDialector(configMap map[string]string) (dialector gorm.Dialector, err error)

func NewRepo added in v0.5.7

func NewRepo[T Repo](conn *gorm.DB, inRepo T) (repo T)

func PostgreDialector added in v1.0.7

func PostgreDialector(configMap map[string]string) (dialector gorm.Dialector, err error)

func SqliteDialector added in v1.0.3

func SqliteDialector(configMap map[string]string) (dialector gorm.Dialector, err error)

Types

type GeneralRepo added in v0.5.7

type GeneralRepo struct {
	// contains filtered or unexported fields
}

func (*GeneralRepo) GetConn added in v0.5.7

func (repo *GeneralRepo) GetConn() *gorm.DB

func (*GeneralRepo) SetConn added in v0.5.7

func (repo *GeneralRepo) SetConn(inConn *gorm.DB)

type Model

type Model struct {
	ID        string         `gorm:"primaryKey;type:varchar(32)" json:"id"`
	CreatedAt *time.Time     `json:"createdAt"`
	UpdatedAt *time.Time     `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type Repo added in v0.5.7

type Repo interface {
	SetConn(inConn *gorm.DB)
	GetConn() *gorm.DB
}

Jump to

Keyboard shortcuts

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