gorm

package module
v0.0.0-...-698e4cb Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 8 Imported by: 0

README

gorm

go orm

Documentation

Index

Constants

View Source
const (
	NoErr myErrCode = iota
	// 单行查询的时候没有一行数据
	NoOnceRowsDate
	// 需要传slice
	NeedSlice
	// 遍历使用的函数错误
	SliceFuncErr
)

Variables

This section is empty.

Functions

func DbQuery

func DbQuery(q DBer, ty interface{}, sql string, args ...interface{}) error

DbQuery 查询数据库表

func DbQueryWithIndexFunc

func DbQueryWithIndexFunc(q DBer, slice interface{}, f func(sliceIndex int) error, sql string, args ...interface{}) error

DbQueryWithIndexFunc 对查询的每一条结果执行f,err!=nil空时返回err

func DbQueryWithModelFunc

func DbQueryWithModelFunc(q DBer, model interface{}, f func(model interface{}) error, sql string, args ...interface{}) error

DbQueryWithModelFunc 对查询的每一条结果执行f,err!=nil空时返回err

func IsThisCode

func IsThisCode(err error, code myErrCode) bool

Types

type DBer

type DBer interface {
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	Exec(query string, args ...interface{}) (sql.Result, error)
}

type NullData

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

func (*NullData) Scan

func (n *NullData) Scan(src interface{}) error

Jump to

Keyboard shortcuts

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