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 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) View(source SQSource, st SQSelect, ifnotexists bool) SQStatement
- func (this *SQReflect) Virtual(source SQSource, module string, ifnotexists bool, options ...string) []SQStatement
- func (this *SQReflect) WithForeignKey(parent SQSource, parentcols ...string) error
- type View
- type Virtual
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 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) View ¶ added in v1.0.51
Return view definition for a given source adding IF NOT EXISTS to the view
func (*SQReflect) Virtual ¶ added in v1.0.51
func (this *SQReflect) Virtual(source SQSource, module string, ifnotexists bool, options ...string) []SQStatement
Return virtual table definition for a given source adding IF NOT EXISTS to the table, and additional options appended to the table creation statement
func (*SQReflect) WithForeignKey ¶
WithForeignKey defines a foreign key to a parent class.
type View ¶ added in v1.0.51
type View struct { *SQReflect SQSource // contains filtered or unexported fields }
func MustRegisterView ¶ added in v1.0.51
MustRegisterView registers a SQObject view class, panics if an error occurs.
func RegisterView ¶ added in v1.0.51
func RegisterView(name SQSource, proto interface{}, leftjoin bool, sources ...SQClass) (*View, error)
RegisterView registers a SQObject view class, returns the class and any errors
func (*View) Create ¶ added in v1.0.51
Create creates a view. If the flag SQLITE_OPEN_OVERWRITE is set when creating the connection, then view is dropped and then re-created.
type Virtual ¶ added in v1.0.51
type Virtual struct { *SQReflect SQSource // contains filtered or unexported fields }
func MustRegisterVirtual ¶ added in v1.0.51
func MustRegisterVirtual(source SQSource, module string, proto interface{}, options ...string) *Virtual
MustRegisterVirtual registers a SQObject virtual table class, panics if an error occurs.
func RegisterVirtual ¶ added in v1.0.51
func RegisterVirtual(source SQSource, module string, proto interface{}, options ...string) (*Virtual, error)
RegisterVirtual registers a SQObject virtual table class, returns the class and any errors
func (*Virtual) Create ¶ added in v1.0.51
Create creates a virtual table. If the flag SQLITE_OPEN_OVERWRITE is set when creating the connection, then tables are dropped and then re-created.