typrails

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TxCtxKey is key for tx
	TxCtxKey key = iota
	// ErrCtxKey is key for error of database
	ErrCtxKey
)

Variables

This section is empty.

Functions

func EntityName

func EntityName(tableName string) string

EntityName return entity name

func ErrCtx added in v0.8.12

func ErrCtx(ctx context.Context) error

ErrCtx return error from context

func Module

func Module() interface{}

Module of typrails

func SetErrCtx added in v0.8.12

func SetErrCtx(ctx context.Context, err error) context.Context

SetErrCtx to set error into context

func SetTxCtx added in v0.8.12

func SetTxCtx(ctx context.Context, tx sq.BaseRunner) context.Context

SetTxCtx to set tx into context

func TxCtx added in v0.8.12

func TxCtx(ctx context.Context, t sq.BaseRunner) sq.BaseRunner

TxCtx return transaction from context if any or return t params

Types

type Entity

type Entity struct {
	Name           string
	Type           string
	Table          string
	Cache          string
	ProjectPackage string
	Fields         []Field
	Forms          []Field
}

Entity of database

type Fetcher

type Fetcher struct {
	dig.In
	*sql.DB
}

Fetcher responsible to fetch entity

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(pkg, tableName string) (e *Entity, err error)

Fetch entity from database based on table name

type Field

type Field struct {
	Name      string
	Type      string
	Udt       string
	Column    string
	StructTag string
}

Field of entity

func CreateField

func CreateField(column, udt string) Field

CreateField to create field

type InfoSchema

type InfoSchema struct {
	ColumnName string
	DataType   string
}

InfoSchema is infomation schema from database

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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