jdb

package
v1.0.83 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandDefine = "DEFINE"
	CommandInsert = "INSERT"
	CommandUpdate = "UPDATE"
	CommandDelete = "DELETE"
)
View Source
const Postgres = "postgres"

Variables

This section is empty.

Functions

func ChangePassword

func ChangePassword(db *DB, name, password string) error

Changue password

func CreateColumn

func CreateColumn(db *DB, schema, table, name, kind, defaultValue string) error

Create column

func CreateDatabase

func CreateDatabase(db *DB, name string) error

Crate database

func CreateIndex

func CreateIndex(db *DB, schema, table, field string) error

Create index

func CreateSchema

func CreateSchema(db *DB, name string) error

Create schema

func CreateSequence

func CreateSequence(db *DB, schema, tag string) error

Create serie

func CreateTrigger

func CreateTrigger(db *DB, schema, table, name, when, event, function string) error

Create trigger

func CreateUser

func CreateUser(db *DB, name, password string) error

Create user

func DropColumn

func DropColumn(db *DB, schema, table, name string) error

Drop column

func DropDatabase

func DropDatabase(db *DB, name string) error

Drop database

func DropIndex

func DropIndex(db *DB, schema, table, field string) error

Drop index

func DropSchema

func DropSchema(db *DB, name string) error

Drop schema

func DropSerie

func DropSerie(db *DB, schema, name string) error

Drop serie

func DropTable

func DropTable(db *DB, schema, name string) error

Drop table

func DropTrigger

func DropTrigger(db *DB, schema, table, name string) error

Drop trigger

func DropUser

func DropUser(db *DB, name string) error

Drop user

func ExistColum

func ExistColum(db *DB, schema, table, name string) (bool, error)

Exist column

func ExistDatabase

func ExistDatabase(db *DB, name string) (bool, error)

Exist database

func ExistIndex

func ExistIndex(db *DB, schema, table, field string) (bool, error)

Exist index

func ExistSchema

func ExistSchema(db *DB, name string) (bool, error)

Exist schema

func ExistSerie

func ExistSerie(db *DB, schema, name string) (bool, error)

Exist serie

func ExistTable

func ExistTable(db *DB, schema, name string) (bool, error)

Exist table

func ExistTrigger

func ExistTrigger(db *DB, schema, table, name string) (bool, error)

Exist trigger

func ExistUser

func ExistUser(db *DB, name string) (bool, error)

Exist user

func InitCore

func InitCore(db *DB) error

func LastSerie

func LastSerie(db *DB, tag string) int

func NextCode

func NextCode(db *DB, tag, prefix string) string

func NextSerie

func NextSerie(db *DB, tag string) int64

func SQLDDL

func SQLDDL(sql string, args ...any) string

* * SQLDDL * @param sql string * @param args ...any * @return string *

func SQLParse

func SQLParse(sql string, args ...any) string

* * SQLParse * @param sql string * @param args ...any * @return string *

func SQLQuote

func SQLQuote(sql string) string

* * SQLQuote * @param sql string * @return string *

func SetSerie

func SetSerie(db *DB, tag string, val int) (int, 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 ConnectTo

func ConnectTo(driver, host string, port int, dbname, user, password, application_name string) (*DB, error)

func Load

func Load() (*DB, error)

* * Load * @return *Conn, error *

func (*DB) Close

func (c *DB) Close() error

func (*DB) Command

func (d *DB) Command(opt, id, sql string, args ...any) (et.Item, error)

* * Command * @param db *DB * @param sql string * @param args ...any * @return et.Items * @return error *

func (*DB) Describe

func (c *DB) Describe() et.Json

func (*DB) GetCommand

func (d *DB) GetCommand(id string) (et.Item, error)

* * GetCommand * @params id string * @return js.Item * @return error *

func (*DB) Query

func (d *DB) Query(sql string, args ...any) (et.Items, error)

* * Query * @param db *DB * @param sql string * @param args ...any * @return et.Items * @return error *

func (*DB) QueryOne

func (d *DB) QueryOne(sql string, args ...any) (et.Item, error)

* * QueryOne * @param db *DB * @param sql string * @param args ...any * @return et.Item * @return error *

func (*DB) SetCommand

func (d *DB) SetCommand(opt, id, query string) error

* * SetCommand * @params query string *

func (*DB) SetListen

func (db *DB) SetListen(channels []string, listen HandlerListend)

* * SetListen * @param channels []string * @param listen HandlerListend *

func (*DB) SetMutex

func (d *DB) SetMutex(opt, id, query string, index int64) error

* * SetMutex * @params id string * @params query string * @params index int64 * @return error *

func (*DB) Source

func (d *DB) Source(sourceField string, sql string, args ...any) (et.Items, error)

* * Source * @param db *DB * @param sourceField string * @param sql string * @param args ...any * @return et.Items * @return error *

func (*DB) SourceOne

func (d *DB) SourceOne(sourceField string, sql string, args ...any) (et.Item, error)

* * SourceOne * @param db *DB * @param sourceField string * @param sql string * @param args ...any * @return et.Item * @return error *

func (*DB) SyncCommand

func (d *DB) SyncCommand() error

* * SyncCommand * @return error *

type HandlerListend

type HandlerListend func(res et.Json)

Jump to

Keyboard shortcuts

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