api

package
v0.0.0-...-970f38b Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest error = errors.New("Bad request")

ErrBadRequest is error for case when bad request

View Source
var ErrDuplicate error = errors.New("Duplicate error")

ErrDuplicate error

View Source
var ErrInternal error = errors.New("Internal error")

ErrInternal is error for case when smth went wrong

View Source
var ErrNotFound error = errors.New("Not found")

ErrNotFound is error for case when entity not found

View Source
var ErrNotInitialised error = errors.New("SQL Migrator is not initialised")

ErrNotInitialised error

View Source
var ErrUndefinedTypeOfAction error = errors.New("Undefined type of action")

ErrUndefinedTypeOfAction error

View Source
var ErrUsersFunc error = errors.New("User's func error")

ErrUsersFunc error

View Source
var ErrUsersSQL error = errors.New("User's SQL string error")

ErrUsersSQL error

View Source
var MigrationStatuses = []string{"not applied", "applied", "error"}

MigrationStatuses is the slice of the migration statuses

View Source
var MigrationTypes = []interface{}{migration.MigrationTypeSQL, migration.MigrationTypeGo}

MigrationTypes is slice of migration types

Functions

func AppErrorConv

func AppErrorConv(err error) (res error)

AppErrorConv is a converter from app errors to api errors

Types

type Configuration

type Configuration struct {
	DSN     string
	Dir     string
	Dialect string
}

Configuration struct

func (*Configuration) DBxConf

func (c *Configuration) DBxConf() *dbx.Configuration

DBxConf converts to the dbx configuration

func (*Configuration) ExpandEnv

func (c *Configuration) ExpandEnv()

ExpandEnv reads env vars

type Logger

type Logger interface {
	Print(v ...interface{})
	Fatal(v ...interface{})
}

Logger interface for application

type Migration

type Migration struct {
	ID   uint
	Name string
	Up   interface{}
	Down interface{}
}

Migration struct Up and Down is a Func or a string (plain SQL text)

func (Migration) CoreMigration

func (m Migration) CoreMigration() *migration.Migration

CoreMigration converts to core migration

type MigrationCreateParams

type MigrationCreateParams struct {
	ID   uint
	Type string
	Name string
}

MigrationCreateParams is struct for params for creation of migration

func (*MigrationCreateParams) CoreParams

func (p *MigrationCreateParams) CoreParams() *migration.CreateParams

CoreParams converts to core params

type MigrationFunc

type MigrationFunc func(tx *sqlx.Tx) error

MigrationFunc type

Jump to

Keyboard shortcuts

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