db

package
v0.0.0-...-da99b17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnNameConversion

func ColumnNameConversion(name string) string

func GetColumnName

func GetColumnName(name string) string

func GetSession

func GetSession() *dbr.Session

func Initialize

func Initialize(dbType, dsn string)

Types

type DbrObjxMap

type DbrObjxMap struct {
	Data  objx.Map
	Valid bool
}

func NewObjxMap

func NewObjxMap(v interface{}) (o DbrObjxMap)

func (DbrObjxMap) MarshalJSON

func (o DbrObjxMap) MarshalJSON() ([]byte, error)

MarshalJSON correctly serializes a NullTime to JSON

func (*DbrObjxMap) Scan

func (o *DbrObjxMap) Scan(value interface{}) error

Scan implements the Scanner interface. The value type must be time.Time or string / []byte (formatted time-string), otherwise Scan fails.

func (*DbrObjxMap) UnmarshalJSON

func (o *DbrObjxMap) UnmarshalJSON(b []byte) error

UnmarshalJSON correctly deserializes an DbrObjxMap from JSON

func (DbrObjxMap) Value

func (o DbrObjxMap) Value() (driver.Value, error)

type Row

type Row struct {
	Table    *Table       `json:"-"`
	Columns  []string     `json:"-"`
	Instance RowInterface `json:"-"`
	// contains filtered or unexported fields
}

func (*Row) BeforeSave

func (r *Row) BeforeSave() error

func (*Row) ContainsPrimaryKeys

func (r *Row) ContainsPrimaryKeys() bool

func (*Row) Delete

func (r *Row) Delete() error

func (*Row) GetColumns

func (r *Row) GetColumns() []string

func (*Row) Initialize

func (r *Row) Initialize() RowInterface

func (*Row) IsValid

func (r *Row) IsValid() bool

func (*Row) Save

func (r *Row) Save() error

type RowInterface

type RowInterface interface {
	GetColumns() []string
	Initialize() RowInterface
	IsValid() bool
	BeforeSave() error
	Save() error
	Delete() error
	ContainsPrimaryKeys() bool
}

type Table

type Table struct {
	Name      string   `json:"-"`
	PkColumns []string `json:"-"`
	Instance  TableInterface
}

func (*Table) Delete

func (t *Table) Delete() *dbr.DeleteBuilder

func (*Table) GetName

func (t *Table) GetName() string

func (*Table) GetRow

func (t *Table) GetRow() RowInterface

func (*Table) GetRowCollection

func (t *Table) GetRowCollection() interface{}

func (*Table) Initialize

func (t *Table) Initialize() TableInterface

func (*Table) Insert

func (t *Table) Insert() *dbr.InsertBuilder

func (*Table) Load

func (t *Table) Load(value ...interface{}) (RowInterface, error)

func (*Table) Select

func (t *Table) Select(column ...string) *dbr.SelectBuilder

func (*Table) Update

func (t *Table) Update() *dbr.UpdateBuilder

type TableInterface

type TableInterface interface {
	Initialize() TableInterface
	Select(column ...string) *dbr.SelectBuilder
	Insert() *dbr.InsertBuilder
	Update() *dbr.UpdateBuilder
	Delete() *dbr.DeleteBuilder
	Load(value ...interface{}) (RowInterface, error)
	GetName() string
	GetRow() RowInterface
	GetRowCollection() interface{}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL