mysql

package
v0.0.0-...-699dfa3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success = ErrHandleResult(iota)
	NotFound
	DB_ERROR
)

Variables

This section is empty.

Functions

func GetTestDB

func GetTestDB() (db *gorm.DB, err error)

func InitDB

func InitDB(cfg Config) (*gorm.DB, error)

func ShouldUnique

func ShouldUnique(c *gin.Context, ctx context.Context, db *gorm.DB, fieldMap map[string]ValuePair, operate func(*gorm.DB) error) bool

fields should unique

Types

type Config

type Config struct {
	ConnectionStr string `yaml:"connStr"`
}

type ErrHandleResult

type ErrHandleResult int

func ErrorHandleAndLog

func ErrorHandleAndLog(c *gin.Context, err error, treatNotFoundAsErr bool, desc string, extra ...interface{}) ErrHandleResult

desc and extra for log

type ValuePair

type ValuePair struct {
	NewVal interface{}
	OldVal interface{}
}

Jump to

Keyboard shortcuts

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