persistence

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDriver added in v0.0.22

func RegisterDriver(driver string, t DriverType) (err error)

func RegisterModel

func RegisterModel(models ...interface{})

Types

type DriverType added in v0.0.23

type DriverType orm.DriverType

RegisterModel

const (
	DRMySQL    DriverType // mysql
	DRSqlite              // sqlite
	DROracle              // oracle
	DRPostgres            // pgsql
	DRTiDB                // TiDB
)

type OrmContext

type OrmContext struct {
	Context orm.Ormer
}

func InitPostgresOrm

func InitPostgresOrm(config PostgresConfig) (context OrmContext, err error)

Initialize

func InitSqliteOrm

func InitSqliteOrm(config SqliteConfig) (context OrmContext, err error)

func (*OrmContext) Transaction added in v0.0.22

func (o *OrmContext) Transaction(h func(ctx OrmContext) error) (err error)

type PostgresConfig

type PostgresConfig struct {
	UserName string

	Password string
	Host     string
	Port     int
	DbName   string
	MaxIdle  int
	MaxConn  int
	InitDb   bool
}

type SqliteConfig

type SqliteConfig struct {
	Database string
}

Jump to

Keyboard shortcuts

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