Documentation ¶
Index ¶
- func ColumnCreateSQL(col Column) string
- func ColumnDropSQL(col Column) string
- func ColumnsSQL(columns ...Column) string
- func ConstraintCreateSQL(ctr Constraint) string
- func ConstraintDropSQL(ctr Constraint) string
- func ConvertParams(sql string) string
- func DefinitionCreateSQL(def Definition) string
- func DefinitionDropSQL(def Definition) string
- func TableDefinitionCreateSQL(def TableDefinition) string
- func TableDefinitionDropSQL(def TableDefinition) string
- type BasicColumn
- type BasicColumnsDefinition
- type BasicConstraint
- type BasicDefinition
- type BasicTable
- func (self *BasicTable) AddColumn(column Column)
- func (self *BasicTable) AddDefinition(definition Definition)
- func (self *BasicTable) AddForeignKey(key *ForeignKey)
- func (self *BasicTable) AddIndex(index *Index)
- func (self BasicTable) Columns() []Column
- func (self BasicTable) Create(tx *Tx) error
- func (self BasicTable) CreateSQL() string
- func (_ BasicTable) DefinitionType() string
- func (self BasicTable) Delete(cond Condition, tx *Tx) error
- func (self BasicTable) Drop(tx *Tx) error
- func (self BasicTable) DropSQL() string
- func (self *BasicTable) Init(name string) *BasicTable
- func (self BasicTable) Insert(rec Record, tx *Tx) error
- func (self BasicTable) PrimaryKey() *Key
- func (self *BasicTable) SetPrimaryKey(key *Key)
- func (self BasicTable) Update(rec Record, cond Condition, tx *Tx) error
- type BasicTableDefinition
- type Column
- type ColumnOption
- type ColumnsDefinition
- type Condition
- type Constraint
- type Cx
- type CxOptions
- type Definition
- type Field
- type ForeignKey
- func (_ ForeignKey) ConstraintType() string
- func (self ForeignKey) Create(tx *Tx) error
- func (self ForeignKey) CreateSQL() string
- func (self ForeignKey) Drop(tx *Tx) error
- func (self ForeignKey) DropSQL() string
- func (self *ForeignKey) Init(table Table, name string, foreignTable Table, columns ...Column) *ForeignKey
- type ForeignKeyAction
- type Index
- type IntegerColumn
- func (self IntegerColumn) Clone(table Table, name string) Column
- func (_ IntegerColumn) ColumnType() string
- func (self IntegerColumn) Create(tx *Tx) error
- func (self IntegerColumn) CreateSQL() string
- func (self IntegerColumn) Drop(tx *Tx) error
- func (self IntegerColumn) DropSQL() string
- func (self *IntegerColumn) Get(record Record) int
- func (self *IntegerColumn) Init(table Table, name string, options ...ColumnOption) *IntegerColumn
- func (self *IntegerColumn) Set(record *Record, value int)
- type Key
- type Record
- func (self Record) Condition(table Table, tx *Tx) (Condition, error)
- func (self Record) Delete(table Table, tx *Tx) error
- func (self Record) Fields() []*Field
- func (self Record) Get(column Column) any
- func (self *Record) Init() *Record
- func (self Record) Modified(column Column, tx *Tx) bool
- func (self Record) Null(column Column) bool
- func (self *Record) Set(column Column, value any)
- func (self Record) Store(table Table, tx *Tx) error
- func (self Record) Stored(column Column, tx *Tx) bool
- func (self Record) StoredValue(column Column, tx *Tx) (any, bool)
- type StoredValues
- type Table
- type TableDefinition
- type TextColumn
- func (self TextColumn) Clone(table Table, name string) Column
- func (_ TextColumn) ColumnType() string
- func (self *TextColumn) Create(tx *Tx) error
- func (self *TextColumn) CreateSQL() string
- func (self *TextColumn) Drop(tx *Tx) error
- func (self *TextColumn) DropSQL() string
- func (self *TextColumn) Get(record Record) string
- func (self *TextColumn) Init(table Table, name string, options ...ColumnOption) *TextColumn
- func (self *TextColumn) Set(record Record, value string)
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColumnCreateSQL ¶
func ColumnDropSQL ¶
func ColumnsSQL ¶
func ConstraintCreateSQL ¶
func ConstraintCreateSQL(ctr Constraint) string
func ConstraintDropSQL ¶
func ConstraintDropSQL(ctr Constraint) string
func ConvertParams ¶
func DefinitionCreateSQL ¶
func DefinitionCreateSQL(def Definition) string
func DefinitionDropSQL ¶
func DefinitionDropSQL(def Definition) string
func TableDefinitionCreateSQL ¶
func TableDefinitionCreateSQL(def TableDefinition) string
func TableDefinitionDropSQL ¶
func TableDefinitionDropSQL(def TableDefinition) string
Types ¶
type BasicColumn ¶
type BasicColumn struct { BasicTableDefinition // contains filtered or unexported fields }
func (BasicColumn) DefinitionType ¶
func (_ BasicColumn) DefinitionType() string
func (BasicColumn) Eq ¶
func (self BasicColumn) Eq(other any) Condition
func (*BasicColumn) Init ¶
func (self *BasicColumn) Init(table Table, name string, options ...ColumnOption) *BasicColumn
func (BasicColumn) OptionSQL ¶
func (self BasicColumn) OptionSQL() string
type BasicColumnsDefinition ¶
type BasicColumnsDefinition struct { BasicTableDefinition // contains filtered or unexported fields }
func (*BasicColumnsDefinition) Columns ¶
func (self *BasicColumnsDefinition) Columns() []Column
func (*BasicColumnsDefinition) Init ¶
func (self *BasicColumnsDefinition) Init(table Table, name string, columns ...Column) *BasicColumnsDefinition
type BasicConstraint ¶
type BasicConstraint struct {
BasicColumnsDefinition
}
func (BasicConstraint) DefinitionType ¶
func (_ BasicConstraint) DefinitionType() string
func (*BasicConstraint) Init ¶
func (self *BasicConstraint) Init(table Table, name string, columns ...Column) *BasicConstraint
type BasicDefinition ¶
type BasicDefinition struct {
// contains filtered or unexported fields
}
func (*BasicDefinition) Init ¶
func (self *BasicDefinition) Init(name string) *BasicDefinition
func (BasicDefinition) Name ¶
func (self BasicDefinition) Name() string
func (BasicDefinition) SQLName ¶
func (self BasicDefinition) SQLName() string
type BasicTable ¶
type BasicTable struct { BasicDefinition // contains filtered or unexported fields }
func NewTable ¶
func NewTable(name string) *BasicTable
func (*BasicTable) AddColumn ¶
func (self *BasicTable) AddColumn(column Column)
func (*BasicTable) AddDefinition ¶
func (self *BasicTable) AddDefinition(definition Definition)
func (*BasicTable) AddForeignKey ¶
func (self *BasicTable) AddForeignKey(key *ForeignKey)
func (*BasicTable) AddIndex ¶
func (self *BasicTable) AddIndex(index *Index)
func (BasicTable) Columns ¶
func (self BasicTable) Columns() []Column
func (BasicTable) Create ¶
func (self BasicTable) Create(tx *Tx) error
func (BasicTable) CreateSQL ¶
func (self BasicTable) CreateSQL() string
func (BasicTable) DefinitionType ¶
func (_ BasicTable) DefinitionType() string
func (BasicTable) Drop ¶
func (self BasicTable) Drop(tx *Tx) error
func (BasicTable) DropSQL ¶
func (self BasicTable) DropSQL() string
func (*BasicTable) Init ¶
func (self *BasicTable) Init(name string) *BasicTable
func (BasicTable) PrimaryKey ¶
func (self BasicTable) PrimaryKey() *Key
func (*BasicTable) SetPrimaryKey ¶
func (self *BasicTable) SetPrimaryKey(key *Key)
type BasicTableDefinition ¶
type BasicTableDefinition struct { BasicDefinition // contains filtered or unexported fields }
func (*BasicTableDefinition) Init ¶
func (self *BasicTableDefinition) Init(table Table, name string) *BasicTableDefinition
func (*BasicTableDefinition) QualifiedName ¶
func (self *BasicTableDefinition) QualifiedName() string
func (*BasicTableDefinition) Table ¶
func (self *BasicTableDefinition) Table() Table
type ColumnsDefinition ¶
type ColumnsDefinition interface { TableDefinition Columns() []Column }
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
func NewCondition ¶
type Constraint ¶
type Constraint interface { ColumnsDefinition ConstraintType() string }
type Cx ¶
type Cx struct { StoredValues // contains filtered or unexported fields }
type CxOptions ¶
type CxOptions struct { Context context.Context Host string Port int Database string User string Password string SSLMode bool }
func DefaultCxOptions ¶
func DefaultCxOptions() CxOptions
type Definition ¶
type ForeignKey ¶
type ForeignKey struct { BasicConstraint OnUpdate ForeignKeyAction OnDelete ForeignKeyAction // contains filtered or unexported fields }
func NewForeignKey ¶
func NewForeignKey(table Table, name string, foreignTable Table, columns ...Column) *ForeignKey
func (ForeignKey) ConstraintType ¶
func (_ ForeignKey) ConstraintType() string
func (ForeignKey) Create ¶
func (self ForeignKey) Create(tx *Tx) error
func (ForeignKey) CreateSQL ¶
func (self ForeignKey) CreateSQL() string
func (ForeignKey) Drop ¶
func (self ForeignKey) Drop(tx *Tx) error
func (ForeignKey) DropSQL ¶
func (self ForeignKey) DropSQL() string
func (*ForeignKey) Init ¶
func (self *ForeignKey) Init(table Table, name string, foreignTable Table, columns ...Column) *ForeignKey
type ForeignKeyAction ¶
type ForeignKeyAction string
const ( CASCADE ForeignKeyAction = "CASCADE" RESTRICT ForeignKeyAction = "RESTRICT" )
type Index ¶
type Index struct { BasicColumnsDefinition // contains filtered or unexported fields }
func (Index) DefinitionType ¶
type IntegerColumn ¶
type IntegerColumn struct {
BasicColumn
}
func NewIntegerColumn ¶
func NewIntegerColumn(table Table, name string, options ...ColumnOption) *IntegerColumn
func (IntegerColumn) ColumnType ¶
func (_ IntegerColumn) ColumnType() string
func (IntegerColumn) Create ¶
func (self IntegerColumn) Create(tx *Tx) error
func (IntegerColumn) CreateSQL ¶
func (self IntegerColumn) CreateSQL() string
func (IntegerColumn) Drop ¶
func (self IntegerColumn) Drop(tx *Tx) error
func (IntegerColumn) DropSQL ¶
func (self IntegerColumn) DropSQL() string
func (*IntegerColumn) Get ¶
func (self *IntegerColumn) Get(record Record) int
func (*IntegerColumn) Init ¶
func (self *IntegerColumn) Init(table Table, name string, options ...ColumnOption) *IntegerColumn
func (*IntegerColumn) Set ¶
func (self *IntegerColumn) Set(record *Record, value int)
type StoredValues ¶
type StoredValues struct {
// contains filtered or unexported fields
}
func (*StoredValues) DeleteStoredValue ¶
func (self *StoredValues) DeleteStoredValue(field *Field)
func (*StoredValues) Init ¶
func (self *StoredValues) Init() *StoredValues
func (*StoredValues) StoreValue ¶
func (self *StoredValues) StoreValue(field *Field)
func (StoredValues) StoredValue ¶
func (self StoredValues) StoredValue(field *Field) (any, bool)
type TableDefinition ¶
type TableDefinition interface { Definition QualifiedName() string Table() Table }
type TextColumn ¶
type TextColumn struct {
BasicColumn
}
func NewTextColumn ¶
func NewTextColumn(table Table, name string, options ...ColumnOption) *TextColumn
func (TextColumn) ColumnType ¶
func (_ TextColumn) ColumnType() string
func (*TextColumn) Create ¶
func (self *TextColumn) Create(tx *Tx) error
func (*TextColumn) CreateSQL ¶
func (self *TextColumn) CreateSQL() string
func (*TextColumn) Drop ¶
func (self *TextColumn) Drop(tx *Tx) error
func (*TextColumn) DropSQL ¶
func (self *TextColumn) DropSQL() string
func (*TextColumn) Get ¶
func (self *TextColumn) Get(record Record) string
func (*TextColumn) Init ¶
func (self *TextColumn) Init(table Table, name string, options ...ColumnOption) *TextColumn
func (*TextColumn) Set ¶
func (self *TextColumn) Set(record Record, value string)
type Tx ¶
type Tx struct { StoredValues // contains filtered or unexported fields }
func (*Tx) DeleteStoredValue ¶
Click to show internal directories.
Click to hide internal directories.