db

package
v0.0.0-...-3dc5271 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)
View Source
var Models = map[string]*ModelDescriptor{}
View Source
var NowFunc = func() time.Time {
	return time.Now()
}

NowFunc returns current time, this function is exported in order to be able to give the flexibility to the developer to customize it according to their needs, e.g:

gorm.NowFunc = func() time.Time {
  return time.Now().UTC()
}

Functions

func Expr

func Expr(expression string, args ...interface{}) *expr

Expr generate raw SQL expression, for example:

DB.Model(&product).Update("price", gorm.Expr("price * ? + ?", 2, 100))

func ToDBName

func ToDBName(name string) string

ToDBName convert string to db name

Types

type DBService

type DBService struct{}

func (*DBService) Dispose

func (p *DBService) Dispose() error

func (*DBService) GetDB

func (p *DBService) GetDB() *gorm.DB

func (*DBService) Init

func (p *DBService) Init() error

type ModelDescriptor

type ModelDescriptor struct {
	Type     interface{}
	New      func() interface{}
	NewSlice func() interface{}
}

type OrderIDs

type OrderIDs []uint64

func (OrderIDs) Len

func (p OrderIDs) Len() int

func (OrderIDs) Less

func (p OrderIDs) Less(i, j int) bool

func (OrderIDs) Swap

func (p OrderIDs) Swap(i, j int)

Jump to

Keyboard shortcuts

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