model

package module
v0.0.0-...-c2969df Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 6 Imported by: 2

README

go-model

介绍

Golang model

使用说明

go get gitee.com/lyhuilin/model

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBIsReady bool

Functions

func Close

func Close() error

func GetSelfDB

func GetSelfDB(dbtype, dbfile, dbuser, dbpass, dbhost, dbport, dbname string) (*gorm.DB, error)

func Init

func Init(dbtype, dbfile, dbuser, dbpass, dbhost, dbport, dbname string) error

func (db *Database) Init() error{

func InitSelfDB

func InitSelfDB(dbtype, dbfile, dbuser, dbpass, dbhost, dbport, dbname string) (*gorm.DB, error)

Types

type Database

type Database struct {
	Self *gorm.DB
}
var DB *Database

func New

func New(dbtype, dbfile, dbuser, dbpass, dbhost, dbport, dbname string) (*Database, error)

func (*Database) Close

func (db *Database) Close() error

type GModel

type GModel struct {
	GID       uint64         `json:"gid" gorm:"primarykey; autoIncrement"`
	CreatedAt time.Time      `json:"-" form:"-"`
	UpdatedAt time.Time      `json:"-" form:"-"`
	DeletedAt gorm.DeletedAt `json:"-" form:"-" gorm:"index"`
}

type Model

type Model struct {
	ID        uint64         `json:"id" gorm:"primarykey; autoIncrement"`
	CreatedAt time.Time      `json:"-" form:"-"` //created_at
	UpdatedAt time.Time      `json:"-" form:"-"` //updated_at
	DeletedAt gorm.DeletedAt `json:"-" form:"-" gorm:"index"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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