Documentation ¶
Index ¶
- type EntityManager
- type GoedbResult
- type GoedbSQLDriver
- func (sqld *GoedbSQLDriver) Close() error
- func (sqld *GoedbSQLDriver) DropTable(i interface{}) error
- func (sqld *GoedbSQLDriver) Find(resultEntitySlice interface{}, where string, params map[string]interface{}) error
- func (sqld *GoedbSQLDriver) First(instance interface{}, where string, params map[string]interface{}) error
- func (sqld *GoedbSQLDriver) GetDBConnection() *sqlx.DB
- func (sqld *GoedbSQLDriver) Insert(instance interface{}) (goedbres GoedbResult, err error)
- func (sqld *GoedbSQLDriver) Migrate(i interface{}, autoCreate bool, dropIfExists bool) (err error)
- func (sqld *GoedbSQLDriver) Model(i interface{}) (metadata.GoedbTable, error)
- func (sqld *GoedbSQLDriver) NativeFind(resultEntitySlice interface{}, sql string, params map[string]interface{}) error
- func (sqld *GoedbSQLDriver) NativeFirst(instance interface{}, sql string, params map[string]interface{}) error
- func (sqld *GoedbSQLDriver) Open(driver string, params string, schema string) error
- func (sqld *GoedbSQLDriver) Remove(i interface{}, where string, params map[string]interface{}) (goedbres GoedbResult, err error)
- func (sqld *GoedbSQLDriver) SetSchema(schema string) (sql.Result, error)
- func (sqld *GoedbSQLDriver) TxBegin() (*sql.Tx, error)
- func (sqld *GoedbSQLDriver) Update(instance interface{}) (goedbres GoedbResult, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityManager ¶
type EntityManager interface { SetSchema(schema string) (sql.Result, error) Open(driver string, params string, schema string) error Close() error GetDBConnection() *sqlx.DB Migrate(i interface{}, autoCreate bool, dropIfExists bool) error DropTable(i interface{}) error Model(i interface{}) (metadata.GoedbTable, error) Insert(i interface{}) (GoedbResult, error) Update(i interface{}) (GoedbResult, error) Remove(i interface{}, where string, params map[string]interface{}) (GoedbResult, error) First(i interface{}, where string, params map[string]interface{}) error Find(i interface{}, where string, params map[string]interface{}) error NativeFirst(i interface{}, query string, params map[string]interface{}) error NativeFind(i interface{}, query string, params map[string]interface{}) error TxBegin() (*sql.Tx, error) }
EntityManager is the manager used to interact with the database
type GoedbResult ¶
GoedbResult is the result for some operation in database
type GoedbSQLDriver ¶
type GoedbSQLDriver struct { Dialect dialect.Dialect Datasource config.Datasource // contains filtered or unexported fields }
GoedbSQLDriver constains the database connection
func (*GoedbSQLDriver) Close ¶
func (sqld *GoedbSQLDriver) Close() error
Close finishes the connection
func (*GoedbSQLDriver) DropTable ¶
func (sqld *GoedbSQLDriver) DropTable(i interface{}) error
DropTable removes a table from the database
func (*GoedbSQLDriver) Find ¶
func (sqld *GoedbSQLDriver) Find(resultEntitySlice interface{}, where string, params map[string]interface{}) error
Find returns all records found
func (*GoedbSQLDriver) First ¶
func (sqld *GoedbSQLDriver) First(instance interface{}, where string, params map[string]interface{}) error
First returns the first record found
func (*GoedbSQLDriver) GetDBConnection ¶
func (sqld *GoedbSQLDriver) GetDBConnection() *sqlx.DB
GetDBConnection returns the DB connection as *sqlx.DB. This method can be used if you wanna perform some query manually
func (*GoedbSQLDriver) Insert ¶
func (sqld *GoedbSQLDriver) Insert(instance interface{}) (goedbres GoedbResult, err error)
Insert creates a new row with the object in the database (it must be migrated)
func (*GoedbSQLDriver) Migrate ¶
func (sqld *GoedbSQLDriver) Migrate(i interface{}, autoCreate bool, dropIfExists bool) (err error)
Migrate creates the table in the database
func (*GoedbSQLDriver) Model ¶
func (sqld *GoedbSQLDriver) Model(i interface{}) (metadata.GoedbTable, error)
Model returns the metadata of each structure migrated
func (*GoedbSQLDriver) NativeFind ¶
func (sqld *GoedbSQLDriver) NativeFind(resultEntitySlice interface{}, sql string, params map[string]interface{}) error
NativeFind returns all records found
func (*GoedbSQLDriver) NativeFirst ¶
func (sqld *GoedbSQLDriver) NativeFirst(instance interface{}, sql string, params map[string]interface{}) error
NativeFirst returns the first record found
func (*GoedbSQLDriver) Open ¶
func (sqld *GoedbSQLDriver) Open(driver string, params string, schema string) error
Open creates the connection with the database **DON'T open a connection** This will be managed by goedb
func (*GoedbSQLDriver) Remove ¶
func (sqld *GoedbSQLDriver) Remove(i interface{}, where string, params map[string]interface{}) (goedbres GoedbResult, err error)
Remove removes a row with the object in the database (it must be migrated)
func (*GoedbSQLDriver) SetSchema ¶
func (sqld *GoedbSQLDriver) SetSchema(schema string) (sql.Result, error)
SetSchema sets the schema as default schema for a datasource
func (*GoedbSQLDriver) TxBegin ¶
func (sqld *GoedbSQLDriver) TxBegin() (*sql.Tx, error)
TxBegin is used to set a transaction
func (*GoedbSQLDriver) Update ¶
func (sqld *GoedbSQLDriver) Update(instance interface{}) (goedbres GoedbResult, err error)
Update updates an object using its primery key