data

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

func GenerateRandomStringURLSafe

func GenerateRandomStringURLSafe(n int) (string, error)

Types

type Models

type Models struct {
	SQLScript interface {
		Register(script *SQLScript) error
		Get(name string) (*SQLScript, error)
		GetAll(projectName string) ([]*SQLScript, error)
	}
	SQLMigration interface {
		Add(mig *SQLMigration) error
		Update(mig *SQLMigration) error
		Remove(mig *SQLMigration) error
		GetAll(table string) ([]*SQLMigration, error)
		GetAllByDir(dir string, env string, table string) ([]*SQLMigration, error)
	}
	SQLMigrationGroup interface {
		Get(env string, table string) (*SQLMigrationGroup, error)
	}
	SQLMigrationsLatest interface {
		Update(mig *SQLMigrationsLatest) error
		AutoUpdateLatest(env string, table string) error
		GetByEnv(env string, table string) ([]*SQLMigrationsLatest, error)
	}
	SQLMigrationTables interface {
		Get(env string) (*SQLMigrationTables, error)
	}
	Project interface {
		Get(name string) (*Project, error)
	}
}

func NewModels

func NewModels(db *sql.DB) Models

type Project

type Project struct {
	Name       string       `json:"name"`
	ID         int          `json:"id"`
	SQLScripts []*SQLScript `json:"sql_script"`
}

type ProjectModel

type ProjectModel struct {
	DB *sql.DB
}

func (ProjectModel) Get

func (m ProjectModel) Get(name string) (*Project, error)

type ROToken

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

type ROTokenModel

type ROTokenModel struct {
	DB *sql.DB
}

func (ROTokenModel) IsValid

func (m ROTokenModel) IsValid(token string) bool

func (ROTokenModel) Register

func (m ROTokenModel) Register() (*ROToken, error)

func (ROTokenModel) Remove

func (m ROTokenModel) Remove(token string) error

type SQLMigration

type SQLMigration struct {
	Env            string     `json:"env"`
	FileID         string     `json:"file_id"`
	File           string     `json:"file"`
	FileOrder      int        `json:"file_order"`
	SourceTable    string     `json:"source_table"`
	MigratedAt     *time.Time `json:"migrated_at"`
	MigratedAtNull bool       `json:"migrated_at_null"`
	ID             int        `json:"id"`
	Script         string     `json:"script"`
	Status         *string    `json:"status"`
}

type SQLMigrationGroup

type SQLMigrationGroup struct {
	Env            string          `json:"env"`
	SourceTable    string          `json:"source_table"`
	MigrationsUp   []*SQLMigration `json:"migrations_up"`
	MigrationsDown []*SQLMigration `json:"migrations_down"`
}

type SQLMigrationGroupModel

type SQLMigrationGroupModel struct {
	DB *sql.DB
}

func (SQLMigrationGroupModel) Get

type SQLMigrationModel

type SQLMigrationModel struct {
	DB *sql.DB
}

func (SQLMigrationModel) Add

func (m SQLMigrationModel) Add(mig *SQLMigration) error

func (SQLMigrationModel) Get

func (m SQLMigrationModel) Get(id int) (*SQLMigration, error)

func (SQLMigrationModel) GetAll

func (m SQLMigrationModel) GetAll(table string) ([]*SQLMigration, error)

func (SQLMigrationModel) GetAllByDir

func (m SQLMigrationModel) GetAllByDir(dir string, env string, table string) ([]*SQLMigration, error)

func (SQLMigrationModel) Remove

func (m SQLMigrationModel) Remove(mig *SQLMigration) error

func (SQLMigrationModel) Update

func (m SQLMigrationModel) Update(mig *SQLMigration) error

type SQLMigrationTable

type SQLMigrationTable struct {
	Table      string          `json:"table"`
	Migrations []*SQLMigration `json:"migrations"`
}

type SQLMigrationTables

type SQLMigrationTables struct {
	Env    string               `json:"env"`
	Tables []*SQLMigrationTable `json:"tables"`
}

type SQLMigrationTablesModel

type SQLMigrationTablesModel struct {
	DB *sql.DB
}

func (SQLMigrationTablesModel) Get

type SQLMigrationsLatest

type SQLMigrationsLatest struct {
	Env             string `json:"env"`
	Table           string `json:"table"`
	SQLMigrationsID int    `json:"sql_migrations_id"`
}

type SQLMigrationsLatestModel

type SQLMigrationsLatestModel struct {
	DB *sql.DB
}

func (SQLMigrationsLatestModel) AutoUpdateLatest

func (m SQLMigrationsLatestModel) AutoUpdateLatest(env string, table string) error

func (SQLMigrationsLatestModel) GetByEnv

func (m SQLMigrationsLatestModel) GetByEnv(env string, table string) ([]*SQLMigrationsLatest, error)

func (SQLMigrationsLatestModel) Update

type SQLScript

type SQLScript struct {
	ProjectID       int    `json:"project_id"`
	Project         string `json:"project"`
	FileLocation    string `json:"file_location"`
	FileID          int    `json:"file_id"`
	SnippitID       int    `json:"snippit_id"`
	SnippitName     string `json:"snippit_name"`
	SnippitLocation string `json:"snippit_location"`
	Script          string `json:"script"`
}

type SQLScriptModel

type SQLScriptModel struct {
	DB *sql.DB
}

func (SQLScriptModel) Get

func (m SQLScriptModel) Get(name string) (*SQLScript, error)

func (SQLScriptModel) GetAll

func (m SQLScriptModel) GetAll(projectName string) ([]*SQLScript, error)

func (SQLScriptModel) Register

func (m SQLScriptModel) Register(script *SQLScript) error

Jump to

Keyboard shortcuts

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