Documentation
¶
Index ¶
- Constants
- func ChangePassword(db *linq.DB, name, password string) error
- func ConnStr(params *linq.Connection) (string, error)
- func Connect(connStr string) (*sql.DB, error)
- func CreateColumn(db *linq.DB, schema, table, name, kind, _default string) error
- func CreateDatabase(db *linq.DB, name string) error
- func CreateIndex(db *linq.DB, schema, table, field string) error
- func CreateSchema(db *linq.DB, name string) error
- func CreateSequence(db *linq.DB, schema, tag string) error
- func CreateTrigger(db *linq.DB, schema, table, name, when, event, function string) error
- func CreateUser(db *linq.DB, name, password string) error
- func DropColumn(db *linq.DB, schema, table, name string) error
- func DropDatabase(db *linq.DB, name string) error
- func DropIndex(db *linq.DB, schema, table, field string) error
- func DropSchema(db *linq.DB, name string) error
- func DropSerie(db *linq.DB, schema, name string) error
- func DropTable(db *linq.DB, schema, name string) error
- func DropTrigger(db *linq.DB, schema, table, name string) error
- func DropUser(db *linq.DB, name string) error
- func ExistColum(db *linq.DB, schema, table, name string) (bool, error)
- func ExistDatabase(db *linq.DB, name string) (bool, error)
- func ExistIndex(db *linq.DB, schema, table, field string) (bool, error)
- func ExistSchema(db *linq.DB, name string) (bool, error)
- func ExistSerie(db *linq.DB, schema, name string) (bool, error)
- func ExistTable(db *linq.DB, schema, name string) (bool, error)
- func ExistTrigger(db *linq.DB, schema, table, name string) (bool, error)
- func ExistUser(db *linq.DB, name string) (bool, error)
- func NewDriver() linq.Driver
- type Postgres
- func (d *Postgres) Connect(params *linq.Connection) (*linq.DB, error)
- func (d *Postgres) CurrentSerie(tag string) (int, error)
- func (d *Postgres) CurrentSql(l *linq.Linq) string
- func (d *Postgres) DCL(command string, params js.Json) (js.Item, error)
- func (d *Postgres) DefineSql(m *linq.Model) string
- func (d *Postgres) DeleteSerie(tag string) error
- func (d *Postgres) DeleteSql(l *linq.Linq) string
- func (d *Postgres) GetCommand(id string) (js.Item, error)
- func (d *Postgres) GetMigrateId(old_id, tag string) (string, error)
- func (d *Postgres) InsertSql(l *linq.Linq) string
- func (d *Postgres) LoadMode() error
- func (d *Postgres) Master(params *linq.Connection) (*linq.DB, error)
- func (d *Postgres) Mode() linq.ModeDatabase
- func (d *Postgres) ModelExist(schema, name string) (bool, error)
- func (d *Postgres) MutationSql(m *linq.Model) string
- func (d *Postgres) NextCode(tag, format string) (string, error)
- func (d *Postgres) NextSerie(tag string) (int, error)
- func (d *Postgres) SelectSql(l *linq.Linq) string
- func (d *Postgres) SetCommand(query string) error
- func (p *Postgres) SetListen(channels []string, listen linq.HandlerListend)
- func (d *Postgres) SetMutex(id, query string, index int64) error
- func (d *Postgres) SetSerie(tag string, val int) error
- func (d *Postgres) SyncCommand() error
- func (d *Postgres) Type() string
- func (d *Postgres) UpSertMigrateId(old_id, _id, tag string) error
- func (d *Postgres) UpdateSql(l *linq.Linq) string
Constants ¶
const ( MSS_PARAM_REQUIRED = "Param is required (%s)" MSG_DRIVER_NOT_FOUND = "Driver not found" ERR_COMMAN_MARCHALING = "Command error marshaling data to JSON: %v" ERR_MASTER_DB_NOT_FOUND = "Master db not found" )
Variables ¶
This section is empty.
Functions ¶
func ChangePassword ¶
ChangePassword change the password of the user
func ConnStr ¶
func ConnStr(params *linq.Connection) (string, error)
* * ConnStr return a connection string * @param params *linq.Connection * @return string * @return error *
func Connect ¶
* * Connect return a connection to a database * @param connStr string * @return *sql.DB * @return error *
func CreateColumn ¶
CreateColumn create a column if not exists in the table
func CreateDatabase ¶
CreateDatabase create a database if not exists
func CreateIndex ¶
CreateIndex create a index if not exists in the table
func CreateSchema ¶
CreateSchema create a schema if not exists
func CreateSequence ¶
CreateSequence create a sequence if not exists
func CreateTrigger ¶
CreateTrigger create a trigger if not exists in the table
func CreateUser ¶
CreateUser create a user if not exists
func DropColumn ¶
DropColumn drop a column if exists in the table
func DropDatabase ¶
DropDatabase drop a database if exists
func DropSchema ¶
DropSchema drop a schema if exists
func DropTrigger ¶
DropTrigger drop a trigger if exists in the table
func ExistColum ¶
ExistColum check if the column exists in the table
func ExistDatabase ¶
* * ExistDatabase check if the database exists * @param db *linq.DB * @param name string * @return bool, error *
func ExistIndex ¶
ExistIndex check if the index exists in the table
func ExistSchema ¶
ExistSchema check if the schema exists
func ExistSerie ¶
ExistSerie check if the serie exists
func ExistTable ¶
ExistTable check if the table exists
func ExistTrigger ¶
ExistTrigger check if the trigger exists in the table
Types ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres struct to define a postgres database
func (*Postgres) Connect ¶
* * Connect to the database * @param params js.Json * @return *linq.DB * @return error *
func (*Postgres) CurrentSerie ¶
* * CurrentSerie return the current value of a serie * @param tag string * @return int *
func (*Postgres) CurrentSql ¶
* * CurrentSql return the sql to select * @param l *linq.Linq * @return string *
func (*Postgres) DCL ¶
* * DCL execute a Data Control Language command * @param command string * @param params js.Json * @return error *
func (*Postgres) DefineSql ¶
* * DefineSql return DDL sql to define a model * @param m *linq.Model * @return string *
func (*Postgres) DeleteSerie ¶
* * DeleteSerie delete a serie * @param tag string * @return int *
func (*Postgres) DeleteSql ¶
* * DeleteSql return the sql to delete * @param l *linq.Linq * @return string *
func (*Postgres) GetCommand ¶
* * GetCommand * @params id string * @return js.Item * @return error *
func (*Postgres) GetMigrateId ¶
* * GetMigrateId get a migrate id * @param old_id string * @param tag string * @return string * @return error *
func (*Postgres) InsertSql ¶
* * InsertSql return the sql to insert * @param l *linq.Linq * @return string *
func (*Postgres) Master ¶
* * Master execute a query * @param db *linq.DB * @param commandListener linq.HandlerListend * @return error *
func (*Postgres) Mode ¶
func (d *Postgres) Mode() linq.ModeDatabase
* * Mode return the mode of the database * @return linq.ModeDatabase *
func (*Postgres) ModelExist ¶
* * ModelExist get a model from the database * @param schema string * @param name string * @return js.Json *
func (*Postgres) MutationSql ¶
* * MutationSql return DDL mutation the sql to mutate * @param l *linq.Linq * @return string *
func (*Postgres) NextCode ¶
* * NextCode return the next code of a serie * @param tag string * @param format string, example 'A000000-2024' A%05d-2024 * @return string * @return error *
func (*Postgres) NextSerie ¶
* * NextSerie return the next value of a serie * @param tag string * @return int * @return error *
func (*Postgres) SelectSql ¶
* * SelectSql return the sql to select * @param l *linq.Linq * @return string *
func (*Postgres) SetCommand ¶
* * SetCommand * @params query string *
func (*Postgres) SetListen ¶
func (p *Postgres) SetListen(channels []string, listen linq.HandlerListend)
func (*Postgres) SetMutex ¶
* * SetMutex * @params id string * @params query string * @params index int64 * @return error *
func (*Postgres) SetSerie ¶
* * SetSerie set the value of a serie * @param tag string * @param val int * @return error *
func (*Postgres) SyncCommand ¶
* * SyncCommand * @return error *
func (*Postgres) UpSertMigrateId ¶
* * UpSertMigrateId upsert a migrate id * @param old_id string * @param _id string * @param tag string * @return error *