Documentation
¶
Index ¶
- Constants
- func DeclType(t reflect.Type) string
- func ValueOf(v interface{}) reflect.Value
- type Class
- func (this *Class) Create(txn SQTransaction, schema string) error
- func (c *Class) DeleteKeys(txn SQTransaction, v ...interface{}) (int, error)
- func (c *Class) DeleteRows(txn SQTransaction, row []int64) (int, error)
- func (this *Class) ForeignKey(parent SQClass, parentcols ...string) SQClass
- func (c *Class) Insert(txn SQTransaction, v ...interface{}) ([]int64, error)
- func (this *Class) Proto() reflect.Value
- func (this *Class) Read(txn SQTransaction) (SQIterator, error)
- func (this *Class) String() string
- func (c *Class) UpdateKeys(txn SQTransaction, v ...interface{}) (int, error)
- func (c *Class) UpsertKeys(txn SQTransaction, v ...interface{}) ([]int64, error)
- func (this *Class) WithForeignKey(parent SQClass, parentcols ...string) error
- type Iterator
- type Objects
- type SQReflect
- func (this *SQReflect) Column(name string) SQColumn
- func (this *SQReflect) Columns() []SQColumn
- func (this *SQReflect) Index(source SQSource, name string) SQIndexView
- func (this *SQReflect) String() string
- func (this *SQReflect) Table(source SQSource, ifnotexists bool) []SQStatement
- func (this *SQReflect) WithForeignKey(parent SQSource, parentcols ...string) error
Constants ¶
const ( SQKeyNone stkey = iota SQKeySelect SQKeyInsert SQKeyDeleteRows SQKeyDeleteKeys SQKeyUpdateKeys SQKeyUpsertKeys SQKeyMax = SQKeyUpdateKeys )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Class ¶
type Class struct { *SQReflect SQSource // contains filtered or unexported fields }
func MustRegisterClass ¶
func MustRegisterClass(source SQSource, proto interface{}) *Class
MustRegisterClass registers a SQObject class, panics if an error occurs.
func RegisterClass ¶
RegisterClass registers a SQObject class, returns the class and any errors
func (*Class) Create ¶
Create creates a table, keys and prepared statements within a transaction. If the flag SQLITE_OPEN_OVERWRITE is set when creating the connection, then tables and indexes are dropped and then re-created.
func (*Class) DeleteKeys ¶
Delete keys in table based on primary keys. Returns number of deleted rows
func (*Class) DeleteRows ¶
Delete from the table based on rowids, returns the number of changes made
func (*Class) ForeignKey ¶
ForeignKey appends a foreign key constraint, panics on error. Optionally sets the columns to refer to in the parent.
func (*Class) Insert ¶
Insert into a table and return rowids. If any autoincremented fields are zero valued, these are automatically set to NULL on insert
func (*Class) Read ¶
Read from table and return an iterator. It is expected that Read would accept a query, including: order, limit, offset, distinct and a list of expressions
func (*Class) UpdateKeys ¶
Update objects by primary key, return number of updated rows
func (*Class) UpsertKeys ¶
func (*Class) WithForeignKey ¶
WithForeignKey appends a foreign key constraint to the class, returns error. Optionally sets the columns to refer to in the parent.
type Objects ¶
type Objects struct {
// contains filtered or unexported fields
}
type SQReflect ¶
type SQReflect struct {
// contains filtered or unexported fields
}
func NewReflect ¶
Return a reflection object for the given struct or nil if the argument is not a pointer to a struct or has no fields which are exported
func (*SQReflect) Table ¶
Return table and index definitions for a given source table adding IF NOT EXISTS to the table and indexes
func (*SQReflect) WithForeignKey ¶
WithForeignKey defines a foreign key to a parent class.