typdb

package
v0.9.21 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultEnvKeys = &EnvKeys{
	DBName: "DBNAME",
	DBUser: "DBUSER",
	DBPass: "DBPASS",
	Host:   "HOST",
	Port:   "PORT",
}

Functions

This section is empty.

Types

type Config

type Config struct {
	DBName string
	DBUser string
	DBPass string
	Host   string
	Port   string
}

type DBRepoAnnot

type DBRepoAnnot struct {
	TagName string // By default is @dbrepo
}

DBRepoAnnot ...

func (*DBRepoAnnot) Annotation added in v0.9.21

func (m *DBRepoAnnot) Annotation() *typgen.Annotation

func (*DBRepoAnnot) GetDest

func (*DBRepoAnnot) GetDest(file string) string

GetDest get destination

func (*DBRepoAnnot) Process

func (m *DBRepoAnnot) Process(c *typgo.Context, directive typgen.Directives) error

Annotate Envconfig to prepare dependency-injection and env-file

type DBTool

type DBTool struct {
	DBToolHandler
	Name         string
	EnvKeys      *EnvKeys
	MigrationSrc string
	SeedSrc      string
	CreateFormat string
	DropFormat   string
	DockerName   string
}

func (*DBTool) Console added in v0.9.21

func (t *DBTool) Console(c *typgo.Context) error

Console interactice for postgres

func (*DBTool) CreateDB

func (t *DBTool) CreateDB(c *typgo.Context) error

CreateDB create database

func (*DBTool) DropDB

func (t *DBTool) DropDB(c *typgo.Context) error

DropDB delete database

func (*DBTool) MigrateDB

func (t *DBTool) MigrateDB(c *typgo.Context) error

MigrateDB migrate database

func (*DBTool) MigrationFile

func (t *DBTool) MigrationFile(c *typgo.Context) error

MigrationFile seed database

func (*DBTool) RollbackDB

func (t *DBTool) RollbackDB(c *typgo.Context) error

RollbackDB rollback database

func (*DBTool) SeedDB

func (t *DBTool) SeedDB(c *typgo.Context) error

SeedDB seed database

func (*DBTool) Task

func (t *DBTool) Task() *typgo.Task

Task for postgres

type DBToolHandler added in v0.9.21

type DBToolHandler interface {
	Connect(*Config) (*sql.DB, error)
	ConnectAdmin(*Config) (*sql.DB, error)
	Migrate(src string, cfg *Config) (*migrate.Migrate, error)
	Console(*DBTool, *typgo.Context) error
}

type EntityTmplData

type EntityTmplData struct {
	typgen.Signature
	Name       string
	Table      string
	Dialect    string
	CtorDB     string
	Pkg        string
	SourcePkg  string
	Dest       string
	Fields     []*Field
	Imports    map[string]string
	PrimaryKey *Field
}

EntityTmplData ...

type EnvKeys

type EnvKeys Config

func EnvKeysWithPrefix

func EnvKeysWithPrefix(prefix string) *EnvKeys

func (*EnvKeys) Config

func (e *EnvKeys) Config() *Config

type Field

type Field struct {
	Name         string
	Type         string
	Column       string
	PrimaryKey   bool
	DefaultValue string
	SkipUpdate   bool
}

Field repo

type MySQLHandler added in v0.9.21

type MySQLHandler struct{}

func (MySQLHandler) Connect added in v0.9.21

func (MySQLHandler) Connect(c *Config) (*sql.DB, error)

func (MySQLHandler) ConnectAdmin added in v0.9.21

func (MySQLHandler) ConnectAdmin(c *Config) (*sql.DB, error)

func (MySQLHandler) Console added in v0.9.21

func (m MySQLHandler) Console(d *DBTool, c *typgo.Context) error

Console interactice for postgres

func (MySQLHandler) Migrate added in v0.9.21

func (m MySQLHandler) Migrate(src string, cfg *Config) (*migrate.Migrate, error)

type MySQLTool added in v0.9.18

type MySQLTool struct {
	Name         string
	EnvKeys      *EnvKeys
	MigrationSrc string
	SeedSrc      string
	DockerName   string
}

func (*MySQLTool) DBTool added in v0.9.18

func (t *MySQLTool) DBTool() *DBTool

func (*MySQLTool) Task added in v0.9.18

func (t *MySQLTool) Task() *typgo.Task

Task for postgress

type PostgresHandler added in v0.9.21

type PostgresHandler struct{}

func (PostgresHandler) Connect added in v0.9.21

func (PostgresHandler) Connect(c *Config) (*sql.DB, error)

func (PostgresHandler) ConnectAdmin added in v0.9.21

func (PostgresHandler) ConnectAdmin(c *Config) (*sql.DB, error)

func (PostgresHandler) Console added in v0.9.21

func (p PostgresHandler) Console(d *DBTool, c *typgo.Context) error

Console interactice for postgres

func (PostgresHandler) Migrate added in v0.9.21

func (p PostgresHandler) Migrate(src string, cfg *Config) (*migrate.Migrate, error)

type PostgresTool added in v0.9.18

type PostgresTool struct {
	Name         string
	EnvKeys      *EnvKeys
	MigrationSrc string
	SeedSrc      string
	DockerName   string
}

func (*PostgresTool) DBTool added in v0.9.18

func (t *PostgresTool) DBTool() *DBTool

func (*PostgresTool) Task added in v0.9.18

func (t *PostgresTool) Task() *typgo.Task

Task for postgres

Jump to

Keyboard shortcuts

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