Documentation
¶
Index ¶
- func ModuleBuilder() *application.ModuleBuilder
- type Configuration
- type DataSource
- type DataSourceManager
- type DataSourceRegistration
- type Database
- type DatabaseBuilder
- type Driver
- type DriverManager
- type DriverRegistration
- type EmptyTable
- type TableGroup
- type TableGroupBuilder
- type TableManager
- type TableNameGetter
- type TableRegistration
- type TableRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModuleBuilder ¶
func ModuleBuilder() *application.ModuleBuilder
ModuleBuilder 用于创建模块 ['github.com/starter-go/libgorm']
Types ¶
type Configuration ¶
type Configuration struct {
Driver string
User string
Password string
Host string
Port int
Database string
Enabled bool
}
Configuration 数据源配置信息
type DataSource ¶
type DataSource interface {
DB() (*gorm.DB, error)
Registration() *DataSourceRegistration
}
DataSource 数据源
type DataSourceManager ¶
type DataSourceManager interface {
GetDataSource(name string) (DataSource, error)
}
DataSourceManager 数据源管理器
type DataSourceRegistration ¶
type DataSourceRegistration struct {
Name string
DataSource DataSource
}
DataSourceRegistration 数据源注册信息
type DatabaseBuilder ¶
DatabaseBuilder 用来创建 Database 实例
func (*DatabaseBuilder) Create ¶
func (inst *DatabaseBuilder) Create() Database
Create 创建 Database 实例
type Driver ¶
type Driver interface {
Open(c *Configuration) (Database, error)
Registration() *DriverRegistration
}
Driver 驱动
type DriverManager ¶
DriverManager 驱动管理器
type DriverRegistration ¶
DriverRegistration 驱动注册信息
type TableGroup ¶
TableGroup 表示一组相关的表格
type TableGroupBuilder ¶
type TableGroupBuilder struct {
// contains filtered or unexported fields
}
TableGroupBuilder 用于创建一组相关的表格信息
func (*TableGroupBuilder) Create ¶
func (inst *TableGroupBuilder) Create() []*TableRegistration
Create 创建表格组
func (*TableGroupBuilder) Entity ¶ added in v0.9.1
func (inst *TableGroupBuilder) Entity(ent any) *TableGroupBuilder
Entity 以 Entity 的形式添加一个表格
func (*TableGroupBuilder) Group ¶
func (inst *TableGroupBuilder) Group(g *TableGroup) *TableGroupBuilder
Group 设置分组信息
func (*TableGroupBuilder) Table ¶
func (inst *TableGroupBuilder) Table(t *TableRegistration) *TableGroupBuilder
Table 添加一个表格
type TableManager ¶
type TableManager interface {
ListAll() []*TableRegistration
}
TableManager 是全局的表格管理器
type TableNameGetter ¶ added in v0.9.1
type TableNameGetter interface {
TableName() string
}
TableNameGetter 用于从实体原型获取表名
type TableRegistration ¶
type TableRegistration struct {
SimpleName string
Group *TableGroup
PrototypeGetter func() any // 用于获取原型
NameGetter func() string // 用于获取完整名称
}
TableRegistration 表示一个表格的注册信息
type TableRegistry ¶
type TableRegistry interface {
ListTableRegistrations() []*TableRegistration
}
TableRegistry 是一个自动化的表格注册器
Click to show internal directories.
Click to hide internal directories.