models

package
v0.0.0-...-cc25344 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Declaration

type Declaration struct {
	DatabaseName string
	TableName    string
	Engine       string
	PartitionBy  string
	Settings     []string
	OrderBy      []string
	Fields       map[string]Field
}

func (*Declaration) GetColumns

func (d *Declaration) GetColumns() []column.ColumnBasic

func (*Declaration) GetField

func (d *Declaration) GetField(name string) (Field, bool)

func (*Declaration) GetFieldNames

func (d *Declaration) GetFieldNames() []string

func (*Declaration) GetFields

func (d *Declaration) GetFields() []Field

func (*Declaration) GetPKFields

func (d *Declaration) GetPKFields() []Field

func (*Declaration) GetPreparedColumns

func (d *Declaration) GetPreparedColumns() []column.ColumnBasic

type Field

type Field struct {
	Index       int16 // Used for sorting and ordering algorithm
	Name        string
	PrimaryKey  bool
	Type        string
	Nullable    bool
	Default     string
	Comment     string
	Column      column.ColumnBasic
	ReflectType reflect.Type
	GoType      interface{}
}

func (Field) GetDDL

func (f Field) GetDDL() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func M

func M() *Manager

func NewManager

func NewManager(cfg *ManagerConfig) *Manager

func (*Manager) GetConfig

func (m *Manager) GetConfig() *ManagerConfig

func (*Manager) GetDeclaration

func (m *Manager) GetDeclaration(model any) (*Declaration, error)

func (*Manager) RegisterModel

func (m *Manager) RegisterModel(model any) error

func (*Manager) SetConfig

func (m *Manager) SetConfig(cfg *ManagerConfig)

type ManagerConfig

type ManagerConfig struct {
	DatabaseName string
}

type Model

type Model interface {
	TableName() string
	Settings() []string
	GetDeclaration() *Declaration
	ScanRow(row chconn.SelectStmt) error
}

type ModelDetails

type ModelDetails struct {
	TableName   string
	Engine      string
	PartitionBy string
	OrderBy     []string
}

type Reflector

type Reflector struct {
	// contains filtered or unexported fields
}

func (*Reflector) ReflectModel

func (r *Reflector) ReflectModel(modelType reflect.Type) (*Declaration, error)

Jump to

Keyboard shortcuts

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