adapter

package
v0.0.0-...-40809a1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGORM

func NewGORM(db *gorm.DB) orm.ORM

NewGORM Returns a new GORMAdapter

Types

type EntityHashConstructor

type EntityHashConstructor struct{}

EntityHashConstructor Constructs entity Hash for a given ORM Model description

func (*EntityHashConstructor) ConstructHash

func (c *EntityHashConstructor) ConstructHash(input interface{}) (ans string, err error)

ConstructHash Constructs Hash for given input

type GORMAdapter

type GORMAdapter struct {
	// contains filtered or unexported fields
}

GORMAdapter Adpater for GORM as used by Room

func (*GORMAdapter) Create

func (adapter *GORMAdapter) Create(entity interface{}) orm.Result

Create Create a row

func (*GORMAdapter) CreateTable

func (adapter *GORMAdapter) CreateTable(entities ...interface{}) orm.Result

CreateTable Create a Table

func (*GORMAdapter) DoInTransaction

func (adapter *GORMAdapter) DoInTransaction(fc func(tx orm.ORM) error) (err error)

DoInTransaction Perform operations specified in the input function in a transaction

func (*GORMAdapter) DropTable

func (adapter *GORMAdapter) DropTable(entities ...interface{}) orm.Result

DropTable Drop a table

func (*GORMAdapter) GetLatestSchemaIdentityHashAndVersion

func (adapter *GORMAdapter) GetLatestSchemaIdentityHashAndVersion() (identityHash string, version int, err error)

GetLatestSchemaIdentityHashAndVersion Query the latest schema master entry

func (*GORMAdapter) GetModelDefinition

func (adapter *GORMAdapter) GetModelDefinition(entity interface{}) (modelDefinition orm.ModelDefinition)

GetModelDefinition Get representation of a database table(entity) as done by ORM

func (*GORMAdapter) GetUnderlyingORM

func (adapter *GORMAdapter) GetUnderlyingORM() interface{}

GetUnderlyingORM Get the underlying ORM for advanced usage

func (*GORMAdapter) HasTable

func (adapter *GORMAdapter) HasTable(entity interface{}) bool

HasTable Check Table exists

func (*GORMAdapter) TruncateTable

func (adapter *GORMAdapter) TruncateTable(entity interface{}) orm.Result

TruncateTable Delete All Values from table

type GORMEntityModel

type GORMEntityModel struct {
	Fields []*GORMField
}

GORMEntityModel Entity Model for GORM for Room

type GORMField

type GORMField struct {
	Name string
	Tag  reflect.StructTag
}

GORMField Representation

Jump to

Keyboard shortcuts

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