orm

package
v0.0.0-...-570e58b Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContextTodo = context.TODO()

Functions

func DB

func DB() *gorm.DB

func GetLangStr

func GetLangStr(lang string) string

func MongoDB

func MongoDB() *mongo.Database

func MongoInit

func MongoInit()

func MongoUnInit

func MongoUnInit()

func ParseParamIntToString

func ParseParamIntToString(m map[string]interface{})

func QueryToMap

func QueryToMap(query string, args ...interface{}) (map[string]interface{}, error)

避免调用QueryToMapArr导致log层级不准确

func QueryToMapArr

func QueryToMapArr(query string, args ...interface{}) ([]map[string]interface{}, error)

func SetDB

func SetDB(initDB *gorm.DB)
func QueryToMap(query string, args ...interface{}) (map[string]interface{}, error) {
	res, err := QueryToMapArr(query, args...)
	if res == nil || len(res) == 0 || err != nil {
		return map[string]interface{}{}, err
	}
	return res[0], err
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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