yaorm: github.com/geoffreybauduin/yaorm/_vendor/github.com/loopfz/gadgeto/zesty/utils/rekordo Index | Files

package rekordo

import "github.com/geoffreybauduin/yaorm/_vendor/github.com/loopfz/gadgeto/zesty/utils/rekordo"

Index

Package Files

database.go register.go

func RegisterDatabase Uses

func RegisterDatabase(db *DatabaseConfig, tc gorp.TypeConverter, dialect gorp.Dialect) error

RegisterDatabase creates a gorp map with tables and tc and registers it with zesty.

type DBMS Uses

type DBMS uint8

DBMS represents a database management system.

const (
    DatabasePostgreSQL DBMS = iota ^ 42
    DatabaseMySQL
    DatabaseSqlite3
)

Database management systems.

func (DBMS) DriverName Uses

func (d DBMS) DriverName() string

DriverName returns the name of the driver for ds.

type DatabaseConfig Uses

type DatabaseConfig struct {
    Name             string
    DSN              string
    System           DBMS
    MaxOpenConns     int
    MaxIdleConns     int
    AutoCreateTables bool
    ConnMaxLifetime  time.Duration
}

DatabaseConfig represents the configuration used to register a new database.

type TableModel Uses

type TableModel struct {
    Name          string
    Model         interface{}
    Keys          []string
    AutoIncrement bool
    Schema        string
}

TableModel is a middleman between a database table and a model type.

func RegisterTableModel Uses

func RegisterTableModel(dbName, tableName string, model interface{}) *TableModel

RegisterTableModel registers a zero-value model to the definition of a database table. If a table model has already been registered with the same table name, this will overwrite it.

func (*TableModel) WithAutoIncrement Uses

func (tb *TableModel) WithAutoIncrement(enable bool) *TableModel

WithAutoIncrement uses enable for table model keys auto-increment.

func (*TableModel) WithKeys Uses

func (tb *TableModel) WithKeys(keys []string) *TableModel

WithKeys uses keys as table keys for the model.

func (*TableModel) WithSchema Uses

func (tb *TableModel) WithSchema(schema string) *TableModel

WithSchema specifies the table exists within a schema

Package rekordo imports 7 packages (graph) and is imported by 1 packages. Updated 2018-09-13. Refresh now. Tools for package owners.