Documentation ¶
Overview ¶
This package defined and implemented databases model. There have three interface:
interface_db.go interface_builder.go interface_model.go
The DB interface defined database connection, query and transaction functions.
The BuilderInterface defined how to generate sql statement and get the results.
The ModelInterface defined orm functions.
And now only support MySQL database, if you want to use another database, you can implement the three interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuilderWraperInterface ¶
type BuilderWraperInterface interface { Select(columns ...string) ModelInterface From(tableName string) ModelInterface Where(columnName, operation, value string) ModelInterface Get() map[string]string }
type Model ¶
type Model struct { ModelInterface // implements ModelInterface // contains filtered or unexported fields }
func (*Model) Builder ¶
func (m *Model) Builder() SQLBuilder.BuilderInterface
func (*Model) SetBuilder ¶
func (m *Model) SetBuilder(b SQLBuilder.BuilderInterface)
type ModelInterface ¶
type ModelInterface interface { // orm functions Insert(interface{}) (int64, error) // Save struct data MultiInsert(...interface{}) ([]int64, error) // builder SetBuilder(SQLBuilder.BuilderInterface) Builder() SQLBuilder.BuilderInterface // transaction TransactionStart() error TransactionCommit() error TransactionRollback() error }
Click to show internal directories.
Click to hide internal directories.