Documentation
¶
Index ¶
- Constants
- Variables
- func DataTx(tx *Tx, db *sql.DB, sourceFiled, sql string, arg ...any) (et.Items, error)
- func Exec(db *sql.DB, sql string, arg ...any) (et.Items, error)
- func JSQL(w http.ResponseWriter, r *http.Request)
- func JsonQuote(val interface{}) interface{}
- func ModelCommand(w http.ResponseWriter, r *http.Request)
- func ModelDefine(w http.ResponseWriter, r *http.Request)
- func ModelDescribe(w http.ResponseWriter, r *http.Request)
- func ModelQuery(w http.ResponseWriter, r *http.Request)
- func OperatorToCommand(op Operator) string
- func Query(db *sql.DB, sql string, arg ...any) (et.Items, error)
- func QueryTx(tx *Tx, db *sql.DB, sql string, arg ...any) (et.Items, error)
- func Register(name string, driver func() Driver, params ConnectParams)
- func RowsToItem(rows *sql.Rows) et.Item
- func RowsToItems(rows *sql.Rows) et.Items
- func RowsToSource(source string, rows *sql.Rows) et.Items
- func SQLDDL(sql string, args ...any) string
- func SQLParse(sql string, args ...any) string
- func SQLQuote(sql string) string
- func SourceToItem(source string, rows *sql.Rows) et.Item
- func StrToKindType(strs string) (TypeColumn, TypeData)
- type Agregation
- type Column
- func (s *Column) DefaultQuote() interface{}
- func (s *Column) DefaultValue() interface{}
- func (s *Column) Describe() et.Json
- func (s *Column) GetField() *Field
- func (s *Column) SetDefaultValue(value interface{}) *Column
- func (s *Column) SetHidden(hidden bool) *Column
- func (s *Column) SetMax(max float64) *Column
- func (s *Column) SetMin(min float64) *Column
- func (s *Column) SetValue(value interface{}) *Column
- type ColumnField
- type Command
- func (s *Command) AfterDelete(fn DataFunctionTx) *Command
- func (s *Command) AfterFuncDelete(jsCode string) *Command
- func (s *Command) AfterFuncInsert(jsCode string) *Command
- func (s *Command) AfterFuncUpdate(jsCode string) *Command
- func (s *Command) AfterInsert(fn DataFunctionTx) *Command
- func (s *Command) AfterInsertOrUpdate(fn DataFunctionTx) *Command
- func (s *Command) AfterInsertOrUpdateFunc(tp TypeEvent, jsCode string) *Command
- func (s *Command) AfterUpdate(fn DataFunctionTx) *Command
- func (s *Command) And(val string) *Command
- func (s *Command) BeforeDelete(fn DataFunctionTx) *Command
- func (s *Command) BeforeFuncDelete(jsCode string) *Command
- func (s *Command) BeforeFuncInsert(jsCode string) *Command
- func (s *Command) BeforeFuncUpdate(jsCode string) *Command
- func (s *Command) BeforeInsert(fn DataFunctionTx) *Command
- func (s *Command) BeforeInsertOrUpdate(fn DataFunctionTx) *Command
- func (s *Command) BeforeInsertOrUpdateFunc(tp TypeEvent, jsCode string) *Command
- func (s *Command) BeforeUpdate(fn DataFunctionTx) *Command
- func (s *Command) Between(vals interface{}) *Command
- func (s *Command) Debug() *Command
- func (s *Command) Describe() et.Json
- func (s *Command) Eq(val interface{}) *Command
- func (s *Command) Exec() (et.Items, error)
- func (s *Command) ExecTx(tx *Tx) (et.Items, error)
- func (s *Command) In(val ...any) *Command
- func (s *Command) IsNull() *Command
- func (s *Command) Less(val interface{}) *Command
- func (s *Command) LessEq(val interface{}) *Command
- func (s *Command) Like(val interface{}) *Command
- func (s *Command) More(val interface{}) *Command
- func (s *Command) MoreEq(val interface{}) *Command
- func (s *Command) Neg(val interface{}) *Command
- func (s *Command) NotNull() *Command
- func (s *Command) One() (et.Item, error)
- func (s *Command) OneTx(tx *Tx) (et.Item, error)
- func (s *Command) Or(val string) *Command
- func (s *Command) Return(fields ...string) *Command
- func (s *Command) Search(language string, val interface{}) *Command
- func (s *Command) Tx() *Tx
- func (s *Command) Where(val string) *Command
- type ConnectParams
- type Connector
- type DB
- func (s *DB) Command(command *Command) (et.Items, error)
- func (s *DB) Conected(params et.Json) error
- func (s *DB) Count(ql *Ql) (int, error)
- func (s *DB) Debug()
- func (s *DB) Describe() et.Json
- func (s *DB) Disconected() error
- func (s *DB) DropModel(model *Model) error
- func (s *DB) DropSchema(name string) error
- func (s *DB) Exists(ql *Ql) (bool, error)
- func (s *DB) From(table string) *Ql
- func (s *DB) GetModel(name string) *Model
- func (s *DB) GetRecycling(schema, name, sysId string) (et.Item, error)
- func (s *DB) GetSchema(name string) *Schema
- func (s *DB) HandlerDeleteRecycling(w http.ResponseWriter, r *http.Request)
- func (s *DB) HandlerGetRecycling(w http.ResponseWriter, r *http.Request)
- func (s *DB) HandlerQueryRecords(w http.ResponseWriter, r *http.Request)
- func (s *DB) HandlerQueryRecycling(w http.ResponseWriter, r *http.Request)
- func (s *DB) Load(kind, name string, out interface{}) error
- func (s *DB) LoadModel(model *Model) error
- func (s *DB) MutateModel(model *Model) error
- func (s *DB) One(sql string, arg ...any) (et.Item, error)
- func (s *DB) Query(sql string, arg ...any) (et.Items, error)
- func (s *DB) QueryModel(search et.Json) (interface{}, error)
- func (s *DB) QueryRecords(query et.Json) (interface{}, error)
- func (s *DB) QueryRecycling(search et.Json) (interface{}, error)
- func (s *DB) Save() error
- func (s *DB) Select(ql *Ql) (et.Items, error)
- func (s *DB) SetDebug(debug bool)
- type DataFunction
- type DataFunctionTx
- type Driver
- type Event
- type EventError
- type Field
- type FullText
- type Function
- type Index
- type JDB
- type Join
- type Model
- func (s *Model) Bulk(data []et.Json) *Command
- func (s *Model) Counted() (int, error)
- func (s *Model) CountedTx(tx *Tx) (int, error)
- func (s *Model) Debug() *Model
- func (s *Model) DefineAtribute(name string, typeData TypeData) *Column
- func (s *Model) DefineCalc(name string, fn DataFunction) *Model
- func (s *Model) DefineColumn(name string, typeData TypeData) *Column
- func (s *Model) DefineCreatedAtField() *Column
- func (s *Model) DefineDetail(name string, fks map[string]string, limit int) *Model
- func (s *Model) DefineEvent(tp TypeEvent, event Event) *Model
- func (s *Model) DefineEventError(event EventError) *Model
- func (s *Model) DefineForeignKey(fks map[string]string, withName string, onDeleteCascade, onUpdateCascade bool) *Model
- func (s *Model) DefineFullText(language string, fields []string) *Column
- func (s *Model) DefineFunc(tp TypeEvent, jsCode string) *Model
- func (s *Model) DefineHidden(colums ...string) *Model
- func (s *Model) DefineIndex(sort bool, colums ...string) *Model
- func (s *Model) DefineIndexField() *Column
- func (s *Model) DefineIntegrity() *Model
- func (s *Model) DefineModel() *Model
- func (s *Model) DefineMultiSelect(name string, fks map[string]string) *Model
- func (s *Model) DefineObject(name, rollupFrom string, fks map[string]string, fields []string) *Model
- func (s *Model) DefinePrimaryKey(colums ...string) *Model
- func (s *Model) DefinePrimaryKeyField() *Model
- func (s *Model) DefineProjectField() *Column
- func (s *Model) DefineProjectModel() *Model
- func (s *Model) DefineRelation(name, relatedTo string, fks map[string]string, limit int) *Relation
- func (s *Model) DefineRequired(colums ...string) *Model
- func (s *Model) DefineRollup(name, rollupFrom string, fks map[string]string, field string) *Column
- func (s *Model) DefineSource(name string) *Column
- func (s *Model) DefineSourceField() *Column
- func (s *Model) DefineStatusField() *Column
- func (s *Model) DefineSystemKeyField() *Column
- func (s *Model) DefineUnique(colums ...string) *Model
- func (s *Model) DefineUpdatedAtField() *Column
- func (s *Model) DefineValues(name string, values interface{}) *Column
- func (s *Model) Delete(val string) *Command
- func (s *Model) Delsert(data et.Json) *Command
- func (s *Model) Describe() et.Json
- func (s *Model) Drop()
- func (s *Model) Emit(channel string, data et.Json) *Model
- func (s *Model) GenId() string
- func (s *Model) GetFrom() *QlFrom
- func (s *Model) GetId(id string) string
- func (s *Model) GetModel(name string) *Model
- func (s *Model) GetWhereByPrimaryKeys(data et.Json) (et.Json, error)
- func (s *Model) GetWhereByRequired(data et.Json) (et.Json, error)
- func (s *Model) Init() error
- func (s *Model) Insert(data et.Json) *Command
- func (s *Model) Join(name string) *QlJoin
- func (s *Model) New(fields ...string) et.Json
- func (s *Model) On(channel string, handler event.Handler) *Model
- func (s *Model) Query(params et.Json) (et.Json, error)
- func (s *Model) QueryTx(tx *Tx, params et.Json) (et.Json, error)
- func (s *Model) Save() error
- func (s *Model) Sync(data et.Json, sysId string) *Command
- func (s *Model) Update(data et.Json) *Command
- func (s *Model) Upsert(data et.Json) *Command
- func (s *Model) Where(val string) *Ql
- type Operator
- type Ql
- func (s *Ql) All() (et.Items, error)
- func (s *Ql) AllTx(tx *Tx) (et.Items, error)
- func (s *Ql) And(val interface{}) *Ql
- func (s *Ql) Avg(field string) *Ql
- func (s *Ql) Between(vals interface{}) *Ql
- func (s *Ql) Count(field string) *Ql
- func (s *Ql) Counted() (int, error)
- func (s *Ql) CountedTx(tx *Tx) (int, error)
- func (s *Ql) Data(fields ...interface{}) *Ql
- func (s *Ql) Debug() *Ql
- func (s *Ql) Describe() et.Json
- func (s *Ql) Eq(val interface{}) *Ql
- func (s *Ql) First(n int) (et.Items, error)
- func (s *Ql) FirstTx(tx *Tx, n int) (et.Items, error)
- func (s *Ql) From(name string) *Ql
- func (s *Ql) FullJoin(m *Model) *QlJoin
- func (s *Ql) GetDetailsTx(tx *Tx, data et.Json)
- func (s *Ql) GroupBy(fields ...string) *Ql
- func (s *Ql) Having(val string) *QlHaving
- func (s *Ql) Hidden(fields ...string) *Ql
- func (s *Ql) In(val ...any) *Ql
- func (s *Ql) IsNull() *Ql
- func (s *Ql) ItExists() (bool, error)
- func (s *Ql) ItExistsTx(tx *Tx) (bool, error)
- func (s *Ql) Join(name interface{}) *QlJoin
- func (s *Ql) Last(n int) (et.Items, error)
- func (s *Ql) LastTx(tx *Tx, n int) (et.Items, error)
- func (s *Ql) LeftJoin(m *Model) *QlJoin
- func (s *Ql) Less(val interface{}) *Ql
- func (s *Ql) LessEq(val interface{}) *Ql
- func (s *Ql) Like(val interface{}) *Ql
- func (s *Ql) List(page, rows int) (et.List, error)
- func (s *Ql) Max(field string) *Ql
- func (s *Ql) Min(field string) *Ql
- func (s *Ql) More(val interface{}) *Ql
- func (s *Ql) MoreEq(val interface{}) *Ql
- func (s *Ql) Neg(val interface{}) *Ql
- func (s *Ql) NotNull() *Ql
- func (s *Ql) One() (et.Item, error)
- func (s *Ql) OneTx(tx *Tx) (et.Item, error)
- func (s *Ql) Or(val interface{}) *Ql
- func (s *Ql) OrderBy(columns ...string) *Ql
- func (s *Ql) OrderByAsc(columns ...string) *Ql
- func (s *Ql) OrderByDesc(columns ...string) *Ql
- func (s *Ql) Page(val int) *Ql
- func (s *Ql) Query(params et.Json) (et.Json, error)
- func (s *Ql) QueryTx(tx *Tx, params et.Json) (et.Json, error)
- func (s *Ql) RightJoin(m *Model) *QlJoin
- func (s *Ql) Rows(n int) (et.Items, error)
- func (s *Ql) RowsTx(tx *Tx, val int) (et.Items, error)
- func (s *Ql) Search(language string, val interface{}) *Ql
- func (s *Ql) Select(fields ...interface{}) *Ql
- func (s *Ql) Sum(field string) *Ql
- func (s *Ql) Tx() *Tx
- func (s *Ql) Where(val interface{}) *Ql
- type QlCondition
- type QlFrom
- type QlFroms
- type QlHaving
- type QlJoin
- func (s *QlJoin) And(val interface{}) *QlJoin
- func (s *QlJoin) Data(fields ...interface{}) *Ql
- func (s *QlJoin) Describe() et.Json
- func (s *QlJoin) On(val string) *QlJoin
- func (s *QlJoin) Or(val interface{}) *QlJoin
- func (s *QlJoin) Select(fields ...interface{}) *Ql
- func (s *QlJoin) Serialize() ([]byte, error)
- type QlJoins
- type QlOrder
- type QlWhere
- func (s *QlWhere) And(val interface{}) *QlWhere
- func (s *QlWhere) Between(vals interface{}) *QlWhere
- func (s *QlWhere) Debug() *QlWhere
- func (s *QlWhere) Eq(val interface{}) *QlWhere
- func (s *QlWhere) In(val ...any) *QlWhere
- func (s *QlWhere) IsNull() *QlWhere
- func (s *QlWhere) Less(val interface{}) *QlWhere
- func (s *QlWhere) LessEq(val interface{}) *QlWhere
- func (s *QlWhere) Like(val interface{}) *QlWhere
- func (s *QlWhere) More(val interface{}) *QlWhere
- func (s *QlWhere) MoreEq(val interface{}) *QlWhere
- func (s *QlWhere) Neg(val interface{}) *QlWhere
- func (s *QlWhere) NotNull() *QlWhere
- func (s *QlWhere) Or(val interface{}) *QlWhere
- func (s *QlWhere) Search(language string, val interface{}) *QlWhere
- func (s *QlWhere) Where(val interface{}) *QlWhere
- type Relation
- type Rollup
- type Schema
- type ShowRollup
- type Tx
- type TypeAgregation
- type TypeColumn
- type TypeCommand
- type TypeData
- type TypeDefinition
- type TypeEvent
- type TypeId
- type TypeJoin
- type TypeResult
- type TypeSelect
Constants ¶
const ( PRIMARYKEY = "id" PK = PRIMARYKEY KEY = PRIMARYKEY INDEX = "idx" PROJECT_ID = "project_id" CREATED_AT = "created_at" UPDATED_AT = "updated_at" STATUS_ID = "status_id" PERMISSION_ID = "permission_id" SYSID = "jdb_id" CREATED_TO = "created_to" UPDATED_TO = "updated_to" FULLTEXT = "fulltext" HISTORYCAL = "historical" CHECKED = "checked" ASC = true )
const ( PostgresDriver = "postgres" SqliteDriver = "sqlite" MysqlDriver = "mysql" OracleDriver = "oracle" )
const ( MSG_KIND_NOT_DEFINED = "Kind not defined" MSG_INVALID_NAME = "Invalid name (%s)" MSG_JDB_NOT_DEFINED = "JDB not defined" MSG_DRIVER_NOT_FOUND = "Driver not found (%s)" MSG_DATABASE_NOT_DEFINED = "Database not defined" MSG_DRIVER_NOT_DEFINED = "Driver not defined" MSS_PARAM_REQUIRED = "Parámetro requerido (%s)" MSG_DATABASE_NOT_FOUND = "Database not found (%s)" MSG_DATABASE_IS_REQUIRED = "Database is required" MSG_SCHEMA_NOT_FOUND = "Schema not found (%s)" MSG_QUERY_FAILED = "Query failed: %s\nSQL: %s" MSG_MODEL_NOT_FOUND = "Model not found (%s)" MSG_MODEL_REQUIRED = "Model is required" MSG_FIELD_NOT_FOUND = "Field not found (%s)" MSG_QUERY_EMPTY = "Query is empty" MSG_QUERY_FROM_REQUIRED = "Query 'from' is required" MSG_SYSTEMKEYFIELD_NOT_FOUND = "SystemKeyField not found" MSG_PRIMARYKEY_NOT_FOUND = "PrimaryKey not found" MSG_NOT_DATA = "No data to %s %s model" MSG_NOT_INSERT_DATA = "No insert data" MSG_MANY_INSERT_DATA = "Many upsert data, only one is allowed" MSG_NOT_UPDATE_DATA = "No update data" MSG_NOT_DELETE_DATA = "No delete data" MSG_KEY_NOT_FOUND = "Key not found" MSG_HISTORY_NOT_DEFINED = "History not defined" MSG_HISTORY_NOT_FOUND = "History not found" MSG_UNDO_NOT_DEFINED = "Undo record not defined" MSG_UNDO_KEY_NOT_DEFINED = "Undo key not defined" MSG_COMMAND_NOT_FOUND = "Command not found" MSG_NOT_COMMAND = "No command" MSG_SYSID_REQUIRED = "Sysid is required" MSG_SCHEMA_NOT_USING_CORE = "Schema is not using core" MSG_DATABASE_NOT_USING_CORE = "Database is not using core" MSG_MODEL_NOT_USING_CORE = "Model is not using core" MSG_ATTRIBUTE_REQUIRED = "Attribute required (%s)" MSG_FIELD_REQUIRED = "Field required (%s) model:%s" MSG_PRIMARY_KEY_REQUIRED = "Primary key required (%s) model:%s" MSG_RECORD_NOT_FOUND = "Record not found" MSG_INVALID_MODEL_PARAM = "Invalid model params" MSG_ROLLBACK_ERROR = "Rollback error: (%s)" MSG_COMMIT_ERROR = "Commit error: (%s)" MSG_DATABASE_NOT_CONNECTED = "Database not connected" MSG_EVENT_NOT_FOUND = "Event not found (%s) in model %s" MSG_DATABASE_NOT_CONCURRENT = "Database not concurrent" MSG_RELATION_WITH_REQUIRED = "Relation with required (%s)" MSG_FOREIGN_KEY_NOT_EXIST = "Foreign key not exist (%s) keys:%s" MSG_REQUIRED_FIELD_REQUIRED = "Required field required (%s)" )
const EVENT_MODEL_DELETE = "model:delete"
const EVENT_MODEL_ERROR = "model:error"
const EVENT_MODEL_INSERT = "model:insert"
const EVENT_MODEL_SYNC = "model:sync"
const EVENT_MODEL_UPDATE = "model:update"
Variables ¶
var ( ErrNotInserted = errors.New("not inserted") ErrNotUpdated = errors.New("not updated") )
Functions ¶
func DataTx ¶ added in v0.1.1
* * DataTx * @param tx *Tx, db *sql.DB, sourceFiled, sql string, arg ...any * @return et.Items, error *
func Exec ¶ added in v0.1.3
* * Exec * @param db *sql.DB, sql string, arg ...any * @return et.Items, error *
func JSQL ¶ added in v0.1.1
func JSQL(w http.ResponseWriter, r *http.Request)
* * JSQL * @param w http.ResponseWriter * @param r *http.Request *
func JsonQuote ¶ added in v0.1.1
func JsonQuote(val interface{}) interface{}
* * JsonQuote return a json quote string * @param val interface{} * @return interface{} *
func ModelCommand ¶
func ModelCommand(w http.ResponseWriter, r *http.Request)
* * modelCommand * @param w http.ResponseWriter * @param r *http.Request *
func ModelDefine ¶
func ModelDefine(w http.ResponseWriter, r *http.Request)
* * ModelDefine * @param w http.ResponseWriter * @param r *http.Request *
func ModelDescribe ¶
func ModelDescribe(w http.ResponseWriter, r *http.Request)
* * ModelDescribe * @param w http.ResponseWriter * @param r *http.Request *
func ModelQuery ¶
func ModelQuery(w http.ResponseWriter, r *http.Request)
* * modelQuery * @param w http.ResponseWriter * @param r *http.Request *
func OperatorToCommand ¶
* * OperatorToCommand * @param op Operator * @return string *
func QueryTx ¶
* * QueryTx * @param tx *Tx, db *sql.DB, sql string, arg ...any * @return *sql.Rows, error *
func Register ¶
func Register(name string, driver func() Driver, params ConnectParams)
* * Register * @param name string, driver func() Driver, params ConnectParams *
func RowsToItem ¶
* * RowsToItem return a item from a sql rows * @param rows *sql.Rows * @return et.Item *
func RowsToItems ¶
* * RowsToItems return a items from a sql rows * @param rows *sql.Rows * @return et.Items *
func RowsToSource ¶
* * SourceToItems return a items from a sql rows and source field * @param source string * @param rows *sql.Rows * @return et.Items *
func SQLDDL ¶
* * SQLDDL return a sql string with the args * @param sql string * @param args ...any * @return string *
func SQLParse ¶
* * SQLParse return a sql string with the args * @param sql string * @param args ...any * @return string *
func SourceToItem ¶
* * SourceToItem return a item from a sql rows and source field * @param source string * @param rows *sql.Rows * @return et.Items *
func StrToKindType ¶ added in v0.1.1
func StrToKindType(strs string) (TypeColumn, TypeData)
Types ¶
type Agregation ¶
type Agregation struct {
Agregation string
// contains filtered or unexported fields
}
type Column ¶
type Column struct {
Model *Model `json:"-"`
Source *Column `json:"-"`
Name string `json:"name"`
Description string `json:"description"`
TypeColumn TypeColumn `json:"type_column"`
TypeData TypeData `json:"type_data"`
Default interface{} `json:"default"`
IsKeyfield bool `json:"is_keyfield"`
Max float64 `json:"max"`
Min float64 `json:"min"`
Hidden bool `json:"hidden"`
Detail *Relation `json:"detail"`
Rollup *Rollup `json:"rollup"`
FullText *FullText `json:"fulltext"`
Values interface{} `json:"values"`
CalcFunction DataFunction `json:"-"`
}
func (*Column) DefaultQuote ¶
func (s *Column) DefaultQuote() interface{}
* * DefaultQuote * @return interface{} *
func (*Column) DefaultValue ¶
func (s *Column) DefaultValue() interface{}
* * DefaultValue * @return interface{} *
func (*Column) SetDefaultValue ¶ added in v0.0.1
* * SetDefaultValue * @param value interface{} * @return *Column *
type ColumnField ¶
type ColumnField string
var ( IndexField ColumnField = INDEX SourceField ColumnField = "source" ProjectField ColumnField = PROJECT_ID CreatedAtField ColumnField = CREATED_AT UpdatedAtField ColumnField = UPDATED_AT StatusField ColumnField = STATUS_ID PrimaryKeyField ColumnField = PRIMARYKEY SystemKeyField ColumnField = SYSID CreatedToField ColumnField = CREATED_TO UpdatedToField ColumnField = UPDATED_TO FullTextField ColumnField = FULLTEXT )
func (ColumnField) Str ¶
func (s ColumnField) Str() string
func (ColumnField) TypeData ¶
func (s ColumnField) TypeData() TypeData
type Command ¶
type Command struct {
*QlWhere
Id string `json:"id"`
Command TypeCommand `json:"command"`
Db *DB `json:"-"`
From *Model `json:"-"`
Data []et.Json `json:"data"`
Values []map[string]*Field `json:"values"`
Returns []*Field `json:"returns"`
Sql string `json:"sql"`
Result et.Items `json:"result"`
Current et.Items `json:"current"`
CurrentMap map[string]et.Json `json:"current_map"`
ResultMap map[string]et.Json `json:"result_map"`
// contains filtered or unexported fields
}
func NewCommand ¶
func NewCommand(model *Model, data []et.Json, command TypeCommand) *Command
* * NewCommand * @param model *Model, data []et.Json, command TypeCommand * @return *Command *
func (*Command) AfterDelete ¶ added in v0.0.1
func (s *Command) AfterDelete(fn DataFunctionTx) *Command
* * AfterDelete * @param fn DataFunctionTx * @return *Command *
func (*Command) AfterFuncDelete ¶ added in v0.1.4
* * AfterVmDelete * @param jsCode string * @return *Command *
func (*Command) AfterFuncInsert ¶ added in v0.1.4
* * AfterFuncInsert * @param jsCode string * @return *Command *
func (*Command) AfterFuncUpdate ¶ added in v0.1.4
* * AfterFuncUpdate * @param jsCode string * @return *Command *
func (*Command) AfterInsert ¶ added in v0.0.1
func (s *Command) AfterInsert(fn DataFunctionTx) *Command
* * AfterInsert * @param fn DataFunction * @return *Command *
func (*Command) AfterInsertOrUpdate ¶ added in v0.1.1
func (s *Command) AfterInsertOrUpdate(fn DataFunctionTx) *Command
* * AfterInsertOrUpdate * @param fn DataFunctionTx * @return *Command *
func (*Command) AfterInsertOrUpdateFunc ¶ added in v0.1.4
* * AfterInsertOrUpdateFunc * @param tp TypeEvent, jsCode string * @return *Command *
func (*Command) AfterUpdate ¶ added in v0.0.1
func (s *Command) AfterUpdate(fn DataFunctionTx) *Command
* * AfterUpdate * @param fn DataFunctionTx * @return *Command *
func (*Command) BeforeDelete ¶ added in v0.0.1
func (s *Command) BeforeDelete(fn DataFunctionTx) *Command
* * BeforeDelete * @param fn DataFunction *
func (*Command) BeforeFuncDelete ¶ added in v0.1.7
* * BeforeFuncDelete * @param jsCode string * @return *Command *
func (*Command) BeforeFuncInsert ¶ added in v0.1.4
* * BeforeFuncInsert * @param jsCode string * @return *Command *
func (*Command) BeforeFuncUpdate ¶ added in v0.1.4
* * BeforeFuncUpdate * @param jsCode string * @return *Command *
func (*Command) BeforeInsert ¶ added in v0.0.1
func (s *Command) BeforeInsert(fn DataFunctionTx) *Command
* * BeforeInsert * @param fn DataFunction *
func (*Command) BeforeInsertOrUpdate ¶ added in v0.1.1
func (s *Command) BeforeInsertOrUpdate(fn DataFunctionTx) *Command
* * BeforeInsertOrUpdate * @param fn DataFunction *
func (*Command) BeforeInsertOrUpdateFunc ¶ added in v0.1.4
* * BeforeInsertOrUpdateFunc * @param tp TypeEvent, jsCode string * @return *Command *
func (*Command) BeforeUpdate ¶ added in v0.0.1
func (s *Command) BeforeUpdate(fn DataFunctionTx) *Command
* * BeforeUpdate * @param fn DataFunction *
type ConnectParams ¶
type ConnectParams struct {
Id string `json:"id"`
Driver string `json:"driver"`
Name string `json:"name"`
UserCore bool `json:"user_core"`
NodeId int `json:"node_id"`
Debug bool `json:"debug"`
Validate []string `json:"validate"`
Params et.Json `json:"params"`
}
func ToConnectParams ¶ added in v0.1.7
func ToConnectParams(params et.Json) *ConnectParams
* * ToConnectParams * @param params et.Json * @return *ConnectParams *
func (*ConnectParams) Json ¶ added in v0.1.7
func (s *ConnectParams) Json() et.Json
* * Json * @return et.Json *
type DB ¶
type DB struct {
CreatedAt time.Time `json:"created_at"`
UpdateAt time.Time `json:"update_at"`
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
UseCore bool `json:"use_core"`
NodeId int `json:"node_id"`
IsDebug bool `json:"-"`
// contains filtered or unexported fields
}
func ConnectTo ¶
func ConnectTo(params ConnectParams) (*DB, error)
* * ConnectTo * @param params et.Json * @return *DB, error *
func NewDatabase ¶
* * NewDatabaseById * @param id, name, driver string * @return *DB, error *
func (*DB) DropSchema ¶
* * DropSchema * @param name string * @return error *
func (*DB) GetRecycling ¶
* * GetRecycling * @param schema, name, sysId string * @return et.Item, error *
func (*DB) HandlerDeleteRecycling ¶
func (s *DB) HandlerDeleteRecycling(w http.ResponseWriter, r *http.Request)
* * HandlerDeleteRecycling * @param w http.ResponseWriter * @param r *http.Request *
func (*DB) HandlerGetRecycling ¶
func (s *DB) HandlerGetRecycling(w http.ResponseWriter, r *http.Request)
* * HandlerGetRecycling * @param w http.ResponseWriter * @param r *http.Request *
func (*DB) HandlerQueryRecords ¶
func (s *DB) HandlerQueryRecords(w http.ResponseWriter, r *http.Request)
* * HandlerQueryRecords * @param w http.ResponseWriter * @param r *http.Request *
func (*DB) HandlerQueryRecycling ¶
func (s *DB) HandlerQueryRecycling(w http.ResponseWriter, r *http.Request)
* * HandlerQueryRecycling * @param w http.ResponseWriter * @param r *http.Request *
func (*DB) MutateModel ¶ added in v0.1.1
* * MutateModel * @param model *Model * @return error *
func (*DB) QueryModel ¶
* * QueryModel * @param search et.Json * @return interface{}, error *
func (*DB) QueryRecords ¶
* * QueryRecords * @param query et.Json * @return interface{}, error *
func (*DB) QueryRecycling ¶
* * QueryRecycling * @param search et.Json * @return interface{}, error *
type DataFunction ¶ added in v0.0.1
type Driver ¶
type Driver interface {
Name() string
Connect(params et.Json) (*sql.DB, error)
Disconnect() error
/* Model */
LoadModel(model *Model) error
DropModel(model *Model) error
MutateModel(model *Model) error
/* Ql */
Select(ql *Ql) (et.Items, error)
Count(ql *Ql) (int, error)
Exists(ql *Ql) (bool, error)
/* Command */
Command(command *Command) (et.Items, error)
}
type EventError ¶
type Field ¶
type Field struct {
Column *Column `json:"-"`
Schema string `json:"schema"`
Model string `json:"model"`
As string `json:"as"`
Name string `json:"name"`
Source string `json:"source"`
Agregation TypeAgregation `json:"agregation"`
Value interface{} `json:"value"`
Alias string `json:"alias"`
Hidden bool `json:"hidden"`
Page int `json:"page"`
Rows int `json:"rows"`
TpResult TypeResult `json:"tp_result"`
Unquoted bool `json:"unquoted"`
Select []interface{} `json:"select"`
Joins []et.Json `json:"joins"`
Where et.Json `json:"where"`
GroupBy []string `json:"group_by"`
Havings et.Json `json:"havings"`
OrderBy et.Json `json:"order_by"`
}
type JDB ¶
type Model ¶
type Model struct {
Db *DB `json:"-"`
Schema string `json:"schema"`
Table string `json:"table"`
CreatedAt time.Time `json:"created_at"`
UpdateAt time.Time `json:"updated_at"`
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
UseCore bool `json:"use_core"`
Integrity bool `json:"integrity"`
Definitions et.Json `json:"definitions"`
Columns []*Column `json:"-"`
PrimaryKeys map[string]*Column `json:"-"`
ForeignKeys map[string]*Relation `json:"-"`
Indices map[string]*Index `json:"-"`
Uniques map[string]*Index `json:"-"`
RelationsTo map[string]*Relation `json:"-"`
RelationsFrom map[string]*Relation `json:"-"`
Joins map[string]*Join `json:"-"`
Required map[string]bool `json:"-"`
TpId TypeId `json:"tp_id"`
CreatedAtField *Column `json:"-"`
UpdatedAtField *Column `json:"-"`
SystemKeyField *Column `json:"-"`
StatusField *Column `json:"-"`
IndexField *Column `json:"-"`
SourceField *Column `json:"-"`
FullTextField *Column `json:"-"`
ProjectField *Column `json:"-"`
Version int `json:"version"`
IsDebug bool `json:"-"`
FuncInsert []string `json:"func_insert"`
FuncUpdate []string `json:"func_update"`
FuncDelete []string `json:"func_delete"`
// contains filtered or unexported fields
}
func LoadModel ¶ added in v0.0.1
* * LoadModel * @param db *DB, name string * @return *Model, error *
func (*Model) DefineAtribute ¶
* * DefineAtribute * @param name string, typeData TypeData * @return *Column *
func (*Model) DefineCalc ¶ added in v0.0.1
func (s *Model) DefineCalc(name string, fn DataFunction) *Model
* * DefineCalc * @param name string, fn DataFunction * @return Model *
func (*Model) DefineColumn ¶
* * DefineColumn * @param name string, typeData TypeData * @return *Column *
func (*Model) DefineCreatedAtField ¶
* * DefineCreatedAtField * @return *Column *
func (*Model) DefineDetail ¶
* * DefineDetail * @param name string, fks map[string]string, limit int * @return *Model *
func (*Model) DefineEvent ¶
* * DefineEvent * @param tp TypeEvent, event Event * @return Model *
func (*Model) DefineEventError ¶
func (s *Model) DefineEventError(event EventError) *Model
* * DefineEventError * @param event EventError * @return Model *
func (*Model) DefineForeignKey ¶
func (s *Model) DefineForeignKey(fks map[string]string, withName string, onDeleteCascade, onUpdateCascade bool) *Model
* * DefineForeignKey * @param fks map[string]string, withName string, onDeleteCascade, onUpdateCascade bool * @return *Model *
func (*Model) DefineFullText ¶
* * DefineFullText * @param language string, fields []string * @return *Model *
func (*Model) DefineFunc ¶ added in v0.1.4
* * DefineFunc * @param tp TypeEvent, jsCode string * @return Model *
func (*Model) DefineHidden ¶
* * DefineHidden * @param colums ...string * @return *Model *
func (*Model) DefineIndex ¶
* * DefineIndex * @param sort bool, colums []string * @return *Model *
func (*Model) DefineIndexField ¶
* * DefineIndexField * @return *Column *
func (*Model) DefineMultiSelect ¶ added in v0.0.1
* * DefineMultiSelect * @param name string, fks map[string]string * @return *Model *
func (*Model) DefineObject ¶ added in v0.0.1
func (s *Model) DefineObject(name, rollupFrom string, fks map[string]string, fields []string) *Model
* * DefineObject * @param name, rollupFrom string, fks map[string]string, field string * @return *Model *
func (*Model) DefinePrimaryKey ¶
* * DefinePrimaryKey * @param colums ...string * @return *Model *
func (*Model) DefinePrimaryKeyField ¶
* * DefinePrimaryKeyField * @return *Model *
func (*Model) DefineProjectField ¶
* * DefineProjectField * @return *Column *
func (*Model) DefineProjectModel ¶
* * DefineProjectModel * @return *Model *
func (*Model) DefineRelation ¶
* * DefineRelation * @param name, relatedTo string, fks map[string]string, limit int * @return *Model *
func (*Model) DefineRequired ¶
* * DefineRequired * @param colums ...string * @return *Model *
func (*Model) DefineRollup ¶
* * DefineRollup * @param name, rollupFrom string, fks map[string]string, field string * @return *Model *
func (*Model) DefineSource ¶
* * DefineSource * @param name string * @return *Column *
func (*Model) DefineSourceField ¶
* * DefineSourceField * @return *Column *
func (*Model) DefineStatusField ¶
* * DefineStatusField * @return *Column *
func (*Model) DefineSystemKeyField ¶
* * DefineSystemKeyField * @return *Column *
func (*Model) DefineUnique ¶
* * DefineUnique * @param colums ...string * @return *Model *
func (*Model) DefineUpdatedAtField ¶
* * DefineUpdatedAtField * @return *Column *
func (*Model) DefineValues ¶ added in v0.0.1
* * DefineValues * @param name string, values interface{} * @return *Column *
func (*Model) GetWhereByPrimaryKeys ¶ added in v0.1.1
* * GetWhereByPrimaryKeys * @param data et.Json * @return et.Json *
func (*Model) GetWhereByRequired ¶ added in v0.0.1
* * GetWhereByRequired * @param data et.Json * @return et.Json *
type Operator ¶
type Operator int
func StrToOperator ¶
* * StrToOperator * @param str string * @return Operator *
type Ql ¶
type Ql struct {
*QlWhere
Id string `json:"id"`
Db *DB `json:"-"`
TypeSelect TypeSelect `json:"type_select"`
Froms *QlFroms `json:"froms"`
Joins []*QlJoin `json:"joins"`
Selects []*Field `json:"selects"`
Hiddens []string `json:"hiddens"`
Details []*Field `json:"details"`
Groups []*Field `json:"group_bys"`
Havings *QlHaving `json:"havings"`
Orders *QlOrder `json:"orders"`
Sheet int `json:"sheet"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Sql string `json:"sql"`
Help et.Json `json:"help"`
// contains filtered or unexported fields
}
func (*Ql) GetDetailsTx ¶
* * GetDetailsTx * @param tx *Tx, data et.Json * @return error *
func (*Ql) ItExistsTx ¶ added in v0.0.1
* * ItExistsTx * @param tx *Tx * @return bool, error *
func (*Ql) OrderByAsc ¶
* * OrderByAsc * @param columns ...any * @return *Ql *
func (*Ql) OrderByDesc ¶
* * OrderByDesc * @param columns ...any * @return *Ql *
type QlCondition ¶
type QlHaving ¶
func NewQlHaving ¶ added in v0.1.1
* * NewQlHaving * @param ql *Ql * @return *QlHaving *
type QlJoin ¶
type QlJoin struct {
*QlWhere
Ql *Ql `json:"-"`
TypeJoin TypeJoin `json:"type_join"`
With *QlFrom `json:"with"`
}
type QlWhere ¶
type QlWhere struct {
Wheres []*QlCondition `json:"wheres"`
IsDebug bool `json:"-"`
// contains filtered or unexported fields
}
type Relation ¶
type Relation struct {
With *Model `json:"-"`
Fk map[string]string `json:"fk"`
Limit int `json:"rows"`
OnDeleteCascade bool `json:"on_delete_cascade"`
OnUpdateCascade bool `json:"on_update_cascade"`
IsMultiSelect bool `json:"is_multi_select"`
}
type Rollup ¶
type Rollup struct {
With *Model `json:"-"`
Fk map[string]string `json:"fk"`
Fields []string `json:"fields"`
Show ShowRollup `json:"show"`
}
type Schema ¶
type Schema struct {
Db *DB `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdateAt time.Time `json:"update_at"`
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
UseCore bool `json:"use_core"`
// contains filtered or unexported fields
}
type ShowRollup ¶ added in v0.0.1
type ShowRollup int
const ( ShowAtrib ShowRollup = iota ShowObject )
type TypeAgregation ¶
type TypeAgregation int
const ( Nag TypeAgregation = iota AgregationSum AgregationCount AgregationAvg AgregationMin AgregationMax )
func (TypeAgregation) Str ¶
func (s TypeAgregation) Str() string
type TypeColumn ¶
type TypeColumn int
const ( TpColumn TypeColumn = iota TpAtribute TpCalc TpRelatedTo TpRollup )
func StrsToTypeColumn ¶ added in v0.1.1
func StrsToTypeColumn(strs string) TypeColumn
* * StrsToTypeColumn * @param strs string * @return TypeColumn *
func (TypeColumn) Str ¶
func (s TypeColumn) Str() string
type TypeCommand ¶
type TypeCommand int
const ( Insert TypeCommand = iota Update Delete Upsert Delsert Sync )
func (TypeCommand) Str ¶ added in v0.0.1
func (s TypeCommand) Str() string
type TypeData ¶
type TypeData int
const ( TypeDataText TypeData = iota TypeDataMemo TypeDataShortText TypeDataKey TypeDataNumber TypeDataInt TypeDataPrecision TypeDataDateTime TypeDataCheckbox TypeDataBytes /* Jsonb */ TypeDataObject TypeDataSelect TypeDataMultiSelect TypeDataGeometry /* Fulltext */ TypeDataFullText /* Objects */ TypeDataState TypeDataUser TypeDataFilesMedia TypeDataUrl TypeDataEmail TypeDataPhone TypeDataAddress TypeDataRelation TypeDataRollup /* None */ TypeDataNone )
func StrsToTypeData ¶ added in v0.1.1
func (TypeData) DefaultValue ¶
func (s TypeData) DefaultValue() interface{}
type TypeDefinition ¶
type TypeDefinition int
const ( TypeDefinitionColumn TypeDefinition = iota TypeDefinitionIndex TypeDefinitionUnique TypeDefinitionPrimaryKey TypeDefinitionPrimaryKeyField TypeDefinitionForeignKey TypeDefinitionSource TypeDefinitionSourceField TypeDefinitionAtribute TypeDefinitionCreatedAtField TypeDefinitionUpdatedAtField TypeDefinitionStatusField TypeDefinitionSystemKeyField TypeDefinitionIndexField TypeDefinitionFullTextField TypeDefinitionProjectField TypeDefinitionHidden TypeDefinitionRequired TypeDefinitionRelation TypeDefinitionRollup TypeDefinitionDetail TypeDefinitionValues TypeDefinitionModel TypeDefinitionProjectModel )
func (TypeDefinition) Str ¶
func (s TypeDefinition) Str() string
type TypeResult ¶
type TypeResult int
const ( TpResult TypeResult = iota TpList )
func StrToTypeResult ¶
func StrToTypeResult(str string) TypeResult
* * StrToTypeResult * @param str string * @return TypeResult *
Source Files
¶
- column.go
- command-after.go
- command-before.go
- command-current.go
- command-delete.go
- command-delsert.go
- command-exec.go
- command-exist.go
- command-insert.go
- command-prepare.go
- command-return.go
- command-sync.go
- command-update.go
- command-upsert.go
- command-where.go
- command.go
- core-model.go
- core-record.go
- core-recycling.go
- core.audit.go
- core.go
- database.go
- drivers.go
- jdb.go
- model-command.go
- model-define.go
- model-emiter.go
- model-event.go
- model-index.go
- model-new.go
- model.go
- msg.go
- ql-agregation.go
- ql-details.go
- ql-field.go
- ql-from.go
- ql-groupby.go
- ql-having.go
- ql-join.go
- ql-limit.go
- ql-orderby.go
- ql-parcer.go
- ql-prepare.go
- ql-query.go
- ql-select.go
- ql-where.go
- ql.go
- query.go
- schema.go
- tx.go
- where.go