orm_base

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(dialectorResolver DialectorResolver, info *DatabaseInfo, config *gorm.Config, tables []interface{}) *gorm.DB

Types

type DataAccess

type DataAccess interface {
	Insert(datarow interface{})
	Select(datafilter interface{}, preloads ...string) interface{}
	Update(datafilter interface{}, datarow interface{})
	Delete(datafilter interface{}, associateds ...string)
}

func NewDataAccess

func NewDataAccess(errorDefer errors.ErrorDefer, db *gorm.DB, modelType reflect.Type) DataAccess

type DataBaseError

type DataBaseError interface {
	errors.CustomError
	GetErrorType() DataBaseErrorType
}

type DataBaseErrorType

type DataBaseErrorType uint8

DataBaseErrorType is the type of the errors from database

const (
	UnexpectedError DataBaseErrorType = iota
	DataRowUnexpected
	DataFilterUnexpected
)

type DatabaseInfo

type DatabaseInfo struct {
	Engine       DbEngine `json:"engine"`
	Host         string   `json:"host"`
	Port         string   `json:"port"`
	Name         string   `json:"name"`
	UserName     string   `json:"user_name"`
	UserPassword string   `json:"user_password"`
}

type DbEngine

type DbEngine uint8
const (
	SqlServer DbEngine = iota
	Postgres
	MySql
	Sqlite
)

func (DbEngine) ToString

func (engine DbEngine) ToString() string

type DialectorGetter

type DialectorGetter interface {
	Get(info *DatabaseInfo) gorm.Dialector
}

type DialectorResolver

type DialectorResolver interface {
	Resolve(info *DatabaseInfo) gorm.Dialector
}

func NewDialectorResolver

func NewDialectorResolver(resolver dependencyinjection.Resolver) DialectorResolver

Directories

Path Synopsis
ioc
ioc

Jump to

Keyboard shortcuts

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