db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsResource

func AsResource(opts ...AsResourceOpt) internal.Resource

func CloseDbConnection

func CloseDbConnection()

func DbeEngine

func DbeEngine() *gorm.DB

func GormDb1

func GormDb1() *gorm.DB

func OpenDbConnection

func OpenDbConnection() (err error)

func OpenDbConnectionWith

func OpenDbConnectionWith(url string) (err error)

Types

type AsResourceOpt

type AsResourceOpt func(r *asResource)

func WithConnectUri

func WithConnectUri(driver string, uri string) AsResourceOpt

type DB

type DB struct {
	// contains filtered or unexported fields
}
var DBE1 *DB

func Dbe

func Dbe() *DB

func New

func New() *DB

func (*DB) AddRoles

func (db *DB) AddRoles(loginName string, roleNames []string) (err error)

func (*DB) AddRolesFor

func (db *DB) AddRolesFor(user *models.User, roleNames []string) (err error)

func (*DB) Close

func (db *DB) Close()

func (*DB) CloseX

func (db *DB) CloseX() (err error)

func (*DB) Engine

func (db *DB) Engine() *gorm.DB

func (*DB) EnsureUserRole

func (db *DB) EnsureUserRole(loginName, roleName string) (err error)

func (*DB) EnsureUserRoles

func (db *DB) EnsureUserRoles(loginName string, roleNames []string) (err error)

func (*DB) LoadRoles

func (db *DB) LoadRoles(r *models.User) (roles []*models.Role, err error)

func (*DB) Open

func (db *DB) Open() (err error)

func (*DB) OpenUrl

func (db *DB) OpenUrl(driver, url string) (err error)

func (*DB) OpenX

func (db *DB) OpenX() (err error)

func (*DB) OpenXUrl

func (db *DB) OpenXUrl(driver, url string) (err error)

func (*DB) RegisterModels

func (db *DB) RegisterModels(models ...interface{}) *DB

func (*DB) UserDrop

func (db *DB) UserDrop(loginName string) (err error)

UserDrop drops a user completely (NOT soft-delete)

func (*DB) XormEngine

func (db *DB) XormEngine() *xorm.Engine

type DatabaseConfig

type DatabaseConfig struct {
	Name              string `yaml:"-"`
	Username          string `yaml:"username"`
	Password          string `yaml:"password"`
	Url               string `yaml:"url"`
	ConnectionTimeout int64  `yaml:"connectionTimeout"`
	MaxOpenConns      int    `yaml:"maxOpenConns"`
	MaxIdleConns      int    `yaml:"maxIdleConns"`
	// contains filtered or unexported fields
}

func InitDatabaseConfig

func InitDatabaseConfig() *DatabaseConfig

type GormLogger

type GormLogger struct{}

func (*GormLogger) Print

func (*GormLogger) Print(v ...interface{})

Jump to

Keyboard shortcuts

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