Documentation
¶
Index ¶
- Constants
- func ChangePassword(db *DB, name, password string) error
- func CreateColumn(db *DB, schema, table, name, kind, defaultValue string) error
- func CreateDatabase(db *DB, name string) error
- func CreateIndex(db *DB, schema, table, field string) error
- func CreateSchema(db *DB, name string) error
- func CreateSequence(db *DB, schema, tag string) error
- func CreateTrigger(db *DB, schema, table, name, when, event, function string) error
- func CreateUser(db *DB, name, password string) error
- func DefineSeries(db *DB) *series
- func DropColumn(db *DB, schema, table, name string) error
- func DropDatabase(db *DB, name string) error
- func DropIndex(db *DB, schema, table, field string) error
- func DropSchema(db *DB, name string) error
- func DropSerie(db *DB, schema, name string) error
- func DropTable(db *DB, schema, name string) error
- func DropTrigger(db *DB, schema, table, name string) error
- func DropUser(db *DB, name string) error
- func ExistColum(db *DB, schema, table, name string) (bool, error)
- func ExistDatabase(db *DB, name string) (bool, error)
- func ExistIndex(db *DB, schema, table, field string) (bool, error)
- func ExistSchema(db *DB, name string) (bool, error)
- func ExistSerie(db *DB, schema, name string) (bool, error)
- func ExistTable(db *DB, schema, name string) (bool, error)
- func ExistTrigger(db *DB, schema, table, name string) (bool, error)
- func ExistUser(db *DB, name string) (bool, error)
- func GetSeries(kind, tag string) (string, error)
- func InitCore(db *DB) error
- func LastSerie(db *DB, tag string) int
- func NextCode(db *DB, tag, prefix string) string
- func NextSerie(db *DB, tag string) int64
- func SQLDDL(sql string, args ...any) string
- func SQLParse(sql string, args ...any) string
- func SQLQuote(sql string) string
- func SetSerie(db *DB, tag string, val int) (int, error)
- func SetSeries(kind, tag string, val int) (int, error)
- func TipoSQL(query string) string
- type DB
- func (d *DB) BeginTx(ctx context.Context) (*Tx, error)
- func (d *DB) Bulck(sql string, args ...any) error
- func (d *DB) BulckContext(ctx context.Context, sql string, args ...any) error
- func (c *DB) Close() error
- func (d *DB) Command(sql string, args ...any) (et.Items, error)
- func (d *DB) CommandContext(ctx context.Context, sql string, args ...any) (et.Items, error)
- func (d *DB) CommandSource(sourceField string, sql string, args ...any) (et.Items, error)
- func (d *DB) CommandSourceContext(ctx context.Context, sourceField string, sql string, args ...any) (et.Items, error)
- func (d *DB) Ddl(sql string, args ...any) error
- func (d *DB) DdlContext(ctx context.Context, sql string, args ...any) error
- func (c *DB) Describe() et.Json
- func (c *DB) HealthCheck() bool
- func (d *DB) Query(sql string, args ...any) (et.Items, error)
- func (d *DB) QueryContext(ctx context.Context, sql string, args ...any) (et.Items, error)
- func (d *DB) QueryOne(sql string, args ...any) (et.Item, error)
- func (d *DB) QueryOneContext(ctx context.Context, sql string, args ...any) (et.Item, error)
- func (d *DB) QueryWithTotal(totalField, sql string, args ...any) (et.Items, int, error)
- func (d *DB) QueryWithTotalContext(ctx context.Context, totalField, sql string, args ...any) (et.Items, int, error)
- func (db *DB) SetListen(channels map[string]HandlerListend)
- func (d *DB) Source(sourceField string, sql string, args ...any) (et.Items, error)
- func (d *DB) SourceContext(ctx context.Context, sourceField string, sql string, args ...any) (et.Items, error)
- func (d *DB) SourceWithTotal(totalField, sourceField, sql string, args ...any) (et.Items, int, error)
- func (d *DB) SourceWithTotalContext(ctx context.Context, totalField, sourceField, sql string, args ...any) (et.Items, int, error)
- type HandlerListend
- type Tx
Constants ¶
const ( Postgres = "postgres" Oracle = "oracle" Mysql = "mysql" )
const ( EVENT_SQL_ERROR = "sql:error" EVENT_SQL_QUERY = "sql:query" EVENT_SQL_DDL = "sql:definition" EVENT_SQL_COMMAND = "sql:command" )
const (
KEY = "_id"
)
Variables ¶
This section is empty.
Functions ¶
func CreateColumn ¶
Create column
func CreateDatabase ¶
* * Created database component *
func CreateTrigger ¶
Create trigger
func DefineSeries ¶ added in v1.1.225
func DefineSeries(db *DB) *series
* * DefineSeries * @param db *DB * @return *series *
func ExistTrigger ¶
Exist trigger
func GetSeries ¶ added in v1.1.225
* * GetSeries * @param kind, tag string * @return string, error *
Types ¶
type DB ¶
type DB struct {
Description string
Driver string
Host string
Port int
Dbname string
Connection string
UseCore bool
// contains filtered or unexported fields
}
func (*DB) BeginTx ¶ added in v1.1.228
* * BeginTx starts a new transaction on the DB connection. * @param ctx context.Context * @return *Tx, error *
func (*DB) BulckContext ¶ added in v1.1.228
* * BulckContext * @param ctx context.Context, sql string, args ...any * @return error *
func (*DB) CommandContext ¶ added in v1.1.228
* * CommandContext * @param ctx context.Context, sql string, args ...any * @return et.Items, error *
func (*DB) CommandSource ¶ added in v1.1.125
func (*DB) CommandSourceContext ¶ added in v1.1.228
func (d *DB) CommandSourceContext(ctx context.Context, sourceField string, sql string, args ...any) (et.Items, error)
* * CommandSourceContext * @param ctx context.Context, sourceField string, sql string, args ...any * @return et.Items, error *
func (*DB) DdlContext ¶ added in v1.1.228
* * DdlContext * @param ctx context.Context, sql string, args ...any * @return error *
func (*DB) HealthCheck ¶ added in v1.1.124
* * HealthCheck * @return bool *
func (*DB) QueryContext ¶ added in v1.1.228
* * QueryContext * @param ctx context.Context, sql string, args ...any * @return et.Items, error *
func (*DB) QueryOneContext ¶ added in v1.1.228
* * QueryOneContext * @param ctx context.Context, sql string, args ...any * @return et.Item, error *
func (*DB) QueryWithTotal ¶ added in v1.1.228
func (*DB) QueryWithTotalContext ¶ added in v1.1.228
func (d *DB) QueryWithTotalContext(ctx context.Context, totalField, sql string, args ...any) (et.Items, int, error)
* * QueryWithTotal runs a query that includes COUNT(*) OVER() AS <totalField>, * strips that column from each row, and returns items + total count. * @param ctx context.Context, totalField string, sql string, args ...any * @return et.Items, int, error *
func (*DB) SetListen ¶
func (db *DB) SetListen(channels map[string]HandlerListend)
* * SetListen * @param channels map[string]HandlerListend *
func (*DB) SourceContext ¶ added in v1.1.228
func (d *DB) SourceContext(ctx context.Context, sourceField string, sql string, args ...any) (et.Items, error)
* * SourceContext * @param ctx context.Context, sourceField string, sql string, args ...any * @return et.Items, error *
func (*DB) SourceWithTotal ¶ added in v1.1.228
func (*DB) SourceWithTotalContext ¶ added in v1.1.228
func (d *DB) SourceWithTotalContext(ctx context.Context, totalField, sourceField, sql string, args ...any) (et.Items, int, error)
* * SourceWithTotal runs a query that includes COUNT(*) OVER() AS <totalField>, * extracts the JSONB source field per row, and returns items + total count. * @param ctx context.Context, totalField string, sourceField string, sql string, args ...any * @return et.Items, int, error *
type HandlerListend ¶
type Tx ¶ added in v1.1.228
type Tx struct {
// contains filtered or unexported fields
}
* * Tx wraps a *sql.Tx exposing the same query methods as DB so that * linq operations can be executed inside a transaction transparently. *
func (*Tx) Command ¶ added in v1.1.228
* * Command executes a DML statement inside the transaction. * @param sql string, args ...any * @return et.Items, error *
func (*Tx) CommandSource ¶ added in v1.1.228
* * CommandSource executes a DML statement inside the transaction and * extracts the JSONB sourceField from each returned row. * @param sourceField string, sql string, args ...any * @return et.Items, error *