sqlite

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexInfo

type IndexInfo struct {
	ColumnName string
	IndexRank  int64
}

type Sqlite

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

Sqlite contains functionality for interacting with a server

func NewSqlite

func NewSqlite(config *lib.ConfigDatabase) *Sqlite

func (*Sqlite) CompareEnums

func (ss *Sqlite) CompareEnums(remoteSchema *schema.Schema, localSchema *schema.Schema, tableName string) (sql string)

func (*Sqlite) Connect

func (ss *Sqlite) Connect() (server *schema.Server, e error)

Connect connects to a server and returns a new server object

func (*Sqlite) CreateChangeSQL

func (ss *Sqlite) CreateChangeSQL(localSchema *schema.Schema, remoteSchema *schema.Schema) *schema.SchemaComparison

CreateChangeSQL generates sql statements based off of comparing two database objects localSchema is authority, remoteSchema will be upgraded to match localSchema

func (*Sqlite) FetchDatabaseTables

func (ss *Sqlite) FetchDatabaseTables(server *schema.Server, databaseName string) (tables map[string]*schema.Table, e error)

FetchDatabaseTables fetches the complete set of tables from this database

func (*Sqlite) FetchDatabases

func (ss *Sqlite) FetchDatabases(server *schema.Server) (databases map[string]*schema.Schema, e error)

FetchDatabases fetches a set of database names from the target server populating the Databases property with a map of Database objects

func (*Sqlite) FetchEnum

func (ss *Sqlite) FetchEnum(server *schema.Server, tableName string) (enums []map[string]interface{})

func (*Sqlite) FetchEnums

func (ss *Sqlite) FetchEnums(server *schema.Server) (enums map[string][]map[string]interface{})

func (*Sqlite) FetchTableColumns

func (ss *Sqlite) FetchTableColumns(server *schema.Server, databaseName string, tableName string) (columns map[string]*schema.Column, e error)

FetchTableColumns lists all of the columns in a table

func (*Sqlite) FetchTableIndices

func (ss *Sqlite) FetchTableIndices(databaseName string, tableName string) []TableIndex

Columns:

  1. Ordinal
  2. Name of the index
  3. "1" if UNIQUE, "0" if not
  4. "c" = created by "CREATE INDEX", "u" if the index was created by "UNIQUE" constraint, "pk" if PRIMARY KEY constraint
  5. "1" if a partial index, "0" if not

func (*Sqlite) UseDatabase

func (ss *Sqlite) UseDatabase(server *schema.Server, databaseName string) (e error)

UseDatabase switches the connection context to the passed in database

type TableIndex

type TableIndex struct {
	Name       string
	Unique     bool
	Partial    bool
	ColumnName string
	PrimaryKey bool
}

Jump to

Keyboard shortcuts

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