table

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	MigrationsColRecordID  = "record_id"
	MigrationsColCreatedAt = "created_at"
	MigrationsColName      = "name"
	MigrationsColStatus    = "status"

	MigrationsTableName = "migrations"

	// MigrationNotRun - Defines the constant for the state of a migration that has not yet been performed
	MigrationNotRun = 0
	// MigrationSuccess - Defines the constant for the state of a successful migration
	MigrationSuccess = 1
	// MigrationFailed - Defines the constant for the state of a migration that has been performed but has failed
	MigrationFailed = 2
)

Constants related to the migrations table

Variables

This section is empty.

Functions

func LoadMigrationByName

func LoadMigrationByName(name string, m *Migration) error

LoadMigrationByName - It takes care of loading the instance of a record of the migrations table given the name

Types

type Migration

type Migration struct {
	RecordID  int64     `db:"record_id"`
	CreatedAt time.Time `db:"created_at"`
	Name      string    `db:"name"`
	Status    int       `db:"status"`
	// contains filtered or unexported fields
}

Migration - Struct that defines the migrations table, implements TableRecordInterface

func InsertNewMigration

func InsertNewMigration(db db.SQLConnector, name string, status int) (*Migration, error)

InsertNewMigration - It takes care of inserting a record in the migrations table

func LoadAllMigrations

func LoadAllMigrations(db db.SQLConnector) ([]*Migration, error)

LoadAllMigrations - Load all instances of Migration from the database

func NewMigration

func NewMigration(db db.SQLConnector) *Migration

NewMigration - It takes care of instantiating a new Migration object by instantiating its TableRecord and setting it as "new" We recommend that you always use this method to create a new Migration instance

func (Migration) GetPrimaryKeyName

func (m Migration) GetPrimaryKeyName() string

GetPrimaryKeyName - Returns the primary key name

func (Migration) GetPrimaryKeyValue added in v1.3.1

func (m Migration) GetPrimaryKeyValue() int64

GetPrimaryKeyValue - Returns the primary key value

func (Migration) GetTableName

func (m Migration) GetTableName() string

GetTableName - Returns the table name

func (Migration) GetTableRecord

func (m Migration) GetTableRecord() *record.TableRecord

GetTableRecord - Returns the instance of TableRecord

Jump to

Keyboard shortcuts

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