vsql

package
v0.0.0-...-5d951de Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSchema

func BuildSchema(driver Driver, queries ...Builder) string

func CopyTable

func CopyTable(from *sqlx.DB, to *sqlx.Tx, name string) error

CopyTable copies the given table from one database to another.

func CopyTables

func CopyTables(from *sqlx.DB, to *sqlx.DB, tables []string) error

CopyTables copies the tables from one database to another. The tables are copied in one unique transaction.

func Migrate

func Migrate(migrations []Migration, db *sqlx.DB, current int) error

Migrate executes all migrations that have not been executed yet. This function needs a migration table containing a version field.

Types

type Builder

type Builder interface {
	Build(driver Driver) string
}

func CreateMigrationTable

func CreateMigrationTable(migrations []Migration) Builder

type Driver

type Driver interface {
	AutoIncrement() string
	ForeignKey() string
}

func DriverFromName

func DriverFromName(name string) Driver

type Migration

type Migration interface {
	Up(tx *sqlx.Tx) error
}

type QueryAlterTable

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

func AlterTable

func AlterTable(name string) *QueryAlterTable

func (*QueryAlterTable) AddField

func (q *QueryAlterTable) AddField(name string, dataType string, options ...string) *QueryAlterTable

func (*QueryAlterTable) Build

func (q *QueryAlterTable) Build(driver Driver) string

func (*QueryAlterTable) RemoveField

func (q *QueryAlterTable) RemoveField(name string) *QueryAlterTable

type QueryCreateMigrationTable

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

func (*QueryCreateMigrationTable) Build

func (q *QueryCreateMigrationTable) Build(driver Driver) string

type QueryCreateTable

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

func CreateTable

func CreateTable(name string) *QueryCreateTable

func (*QueryCreateTable) Build

func (q *QueryCreateTable) Build(driver Driver) string

func (*QueryCreateTable) WithCreatedAt

func (q *QueryCreateTable) WithCreatedAt() *QueryCreateTable

func (*QueryCreateTable) WithDeletedAt

func (q *QueryCreateTable) WithDeletedAt() *QueryCreateTable

func (*QueryCreateTable) WithField

func (q *QueryCreateTable) WithField(name string, dataType string, options ...string) *QueryCreateTable

func (*QueryCreateTable) WithForeignKey

func (q *QueryCreateTable) WithForeignKey(field string, table string, reference string) *QueryCreateTable

func (*QueryCreateTable) WithID

func (q *QueryCreateTable) WithID() *QueryCreateTable

func (*QueryCreateTable) WithPrimaryKey

func (q *QueryCreateTable) WithPrimaryKey(fields ...string) *QueryCreateTable

func (*QueryCreateTable) WithUpdatedAt

func (q *QueryCreateTable) WithUpdatedAt() *QueryCreateTable

type QueryInsert

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

func InsertInto

func InsertInto(table string) *QueryInsert

func (*QueryInsert) Build

func (q *QueryInsert) Build(driver Driver) string

func (*QueryInsert) Columns

func (q *QueryInsert) Columns(columns ...string) *QueryInsert

func (*QueryInsert) Values

func (q *QueryInsert) Values(values ...interface{}) *QueryInsert

type QueryRemoveField

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

func (*QueryRemoveField) Build

func (q *QueryRemoveField) Build(driver Driver) string

type QueryWithCreatedAt

type QueryWithCreatedAt struct{}

func (*QueryWithCreatedAt) Build

func (q *QueryWithCreatedAt) Build(driver Driver) string

type QueryWithDeletedAt

type QueryWithDeletedAt struct{}

func (*QueryWithDeletedAt) Build

func (q *QueryWithDeletedAt) Build(driver Driver) string

type QueryWithField

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

func (*QueryWithField) Build

func (q *QueryWithField) Build(driver Driver) string

type QueryWithForeignKey

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

func (*QueryWithForeignKey) Build

func (q *QueryWithForeignKey) Build(driver Driver) string

type QueryWithID

type QueryWithID struct{}

func (*QueryWithID) Build

func (q *QueryWithID) Build(driver Driver) string

type QueryWithPrimaryKey

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

func (*QueryWithPrimaryKey) Build

func (q *QueryWithPrimaryKey) Build(driver Driver) string

type QueryWithUpdatedAt

type QueryWithUpdatedAt struct{}

func (*QueryWithUpdatedAt) Build

func (q *QueryWithUpdatedAt) Build(driver Driver) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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