orm

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Context      context.Context
	Debug        bool
	Once         bool // use once for close db,when connector used same driver
	Names        []string
	Connector    Connector            // use for single database
	Connectors   map[string]Connector // use for multi database, if needed
	Dialect      string               // mysql/postgres/sqlite3/...
	ORM          string               // gorm,ent,xorm,...
	DSN          string
	MaxLifetime  int
	MaxIdleTime  int
	MaxOpenConns int
	MaxIdleConns int
	Hooks        map[string]Hook
}

type Connector

type Connector interface {
	Open(config Config) (any, error)
	Close() error
}

type Hook

type Hook interface {
}

type ORM

type ORM interface {
	Config() Config
	Connect(name string, connector Connector) error
	DB(name string) any
	Close() error
}

func New

func New(config Config) (ORM, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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