room

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApplicableMigrations

func GetApplicableMigrations(migrations []orm.Migration, src orm.VersionNumber, dest orm.VersionNumber) (applicableMigrations []orm.Migration, err error)

GetApplicableMigrations Fetches applicable migrations based on src and destination version numbers

func GetDBCleanUpFunction

func GetDBCleanUpFunction(entities []interface{}) func(orm.ORM) error

GetDBCleanUpFunction Gives you a function that dictates the DB clean up transaction

Types

type GoRoomSchemaMaster

type GoRoomSchemaMaster struct {
	Version      orm.VersionNumber `gorm:"primary_key"`
	IdentityHash string
}

GoRoomSchemaMaster Tracks the schema of entities against current version of DB

type Initializer

type Initializer interface {
	Init(currentIdentityHash string) (shouldRetryAfterDestruction bool, err error)
	CalculateIdentityHash() (string, error)
	PerformDBCleanUp() error
}

Initializer Interface that exposes functions for initializing a Room managed DB

type Room

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

Room Tracks the database objects, properties and configuration

func New

func New(entities []interface{}, dba orm.ORM, version orm.VersionNumber,
	migrations []orm.Migration, identityCalculator orm.IdentityHashCalculator) (room *Room, errors []error)

New Returns a new room struct that can be used to initialize and get a DB managed by room

func (*Room) CalculateIdentityHash

func (appDB *Room) CalculateIdentityHash() (string, error)

CalculateIdentityHash Calculate the identity hash for current Room instance

func (*Room) Init

func (appDB *Room) Init(currentIdentityHash string) (shouldRetryAfterDestruction bool, err error)

Init Initialize Room Database

func (*Room) PerformDBCleanUp

func (appDB *Room) PerformDBCleanUp() error

PerformDBCleanUp Cleans up existing DB removing Room metadata and all known entities

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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