Documentation
¶
Index ¶
- Variables
- func JoinToKeyValue(left []et.Json, key string, value any) []et.Json
- func JoinToMap(left, right []et.Json) []et.Json
- func Validate(item et.Json, conditions []*Condition) bool
- type BetweenValue
- type Command
- type Condition
- func Between(field string, min, max any) *Condition
- func Eq(field string, value interface{}) *Condition
- func In(field string, value []interface{}) *Condition
- func Is(field string, value interface{}) *Condition
- func IsNot(field string, value interface{}) *Condition
- func Less(field string, value interface{}) *Condition
- func LessEq(field string, value interface{}) *Condition
- func Like(field string, value interface{}) *Condition
- func More(field string, value interface{}) *Condition
- func MoreEq(field string, value interface{}) *Condition
- func Neg(field string, value interface{}) *Condition
- func NotBetween(field string, min, max any) *Condition
- func NotIn(field string, value []interface{}) *Condition
- func NotNull(field string) *Condition
- func Null(field string) *Condition
- func ToCondition(json et.Json) *Condition
- type Connector
- type Model
- func (s *Model) GetIndex(field, key string, dest map[string]bool) (bool, error)
- func (s *Model) GetObjet(idx string, dest et.Json) (bool, error)
- func (s *Model) Key() string
- func (s *Model) Next(fn func(idx string, item et.Json) (bool, error), asc bool, ...) error
- func (s *Model) OnGetIndex(getIndexFn func(field, key string, dest map[string]bool) (bool, error))
- func (s *Model) OnGetObject(getObjectFn func(idx string, dest et.Json) (bool, error))
- func (s *Model) OnNext(...)
- type NextFn
- type Operator
- type Status
- type Transaction
- type Tx
- type Where
- func (s *Where) Add(condition *Condition) *Where
- func (s *Where) AdddResult(item et.Json) (next bool)
- func (s *Where) And(condition *Condition) *Where
- func (s *Where) Asc(field string) *Where
- func (s *Where) Desc(field string) *Where
- func (s *Where) First(tx *Tx) et.Json
- func (s *Where) Hidden(fields ...string) *Where
- func (s *Where) IsDebug() *Where
- func (s *Where) Join(fields ...string) *Where
- func (s *Where) Last(tx *Tx) et.Json
- func (s *Where) Limit(page int, rows int) *Where
- func (s *Where) One(tx *Tx, idx int) et.Json
- func (s *Where) Or(condition *Condition) *Where
- func (s *Where) Order(field string, asc bool) *Where
- func (s *Where) Run(tx *Tx) []et.Json
- func (s *Where) Select(fields ...string) *Where
- func (s *Where) ToJson() (et.Json, error)
- func (s *Where) Where(condition *Condition) *Where
Constants ¶
This section is empty.
Variables ¶
var ( ErrorFieldNotFound = errors.New(msg.MSG_FIELD_NOT_FOUND) ErrorDataNotFound = errors.New(msg.MSG_DATA_NOT_FOUND) )
Functions ¶
func JoinToKeyValue ¶
* * JoinToKeyValue * @params left []et.Json, key string, value any * @return []et.Json *
Types ¶
type BetweenValue ¶
type Condition ¶
type Condition struct {
Field string `json:"field"`
Operator Operator `json:"operator"`
Value any `json:"value"`
Connector Connector `json:"connector"`
}
func NotBetween ¶
* * NotBetween * @param field string, min any, max any * @return Condition *
func ToCondition ¶
* * ToCondition * @param json et.Json * @return *Condition *
func (*Condition) ApplyToIndex ¶
* * ApplyToIndex * @param keys []string * @return []string *
func (*Condition) ApplyToObject ¶
* * ApplyToObject * @param obj et.Json * @return bool *
func (*Condition) ApplyToValue ¶
* * ApplyToValue * @param val any * @return bool *
type Model ¶
type Model struct {
Host string `json:"host"`
Database string `json:"database"`
Schema string `json:"schema"`
Name string `json:"name"`
Hidden []string `json:"hidden"`
IdxField string `json:"idx_field"`
// contains filtered or unexported fields
}
func (*Model) OnGetIndex ¶
func (*Model) OnGetObject ¶
type Operator ¶
type Operator string
const ( OpEq Operator = "eq" OpNeg Operator = "neg" OpLess Operator = "less" OpLessEq Operator = "less_eq" OpMore Operator = "more" OpMoreEq Operator = "more_eq" OpLike Operator = "like" OpIn Operator = "in" OpNotIn Operator = "not_in" OpIs Operator = "is" OpIsNot Operator = "is_not" OpNull Operator = "null" OpNotNull Operator = "not_null" OpBetween Operator = "between" OpNotBetween Operator = "not_between" )
func ToOperator ¶
type Status ¶
type Status string
const ( Active Status = "active" Archived Status = "archived" Canceled Status = "canceled" OfSystem Status = "of_system" ForDelete Status = "for_delete" Pending Status = "pending" Approved Status = "approved" Rejected Status = "rejected" Failed Status = "failed" Processed Status = "processed" Connected Status = "connected" Disconnected Status = "disconnected" )
type Transaction ¶
type Tx ¶
type Tx struct {
StartedAt time.Time `json:"startedAt"`
LastUpdateAt time.Time `json:"lastUpdateAt"`
ID string `json:"id"`
Transactions []*Transaction `json:"transactions"`
// contains filtered or unexported fields
}
func GetTx ¶
* * GetTx: Returns the Transaction for the session * @param tx *Tx * @return (*Tx, bool) *
func (*Tx) AddTransaction ¶
* * AddTransaction: Adds data to the Transaction * @param from *Model, cmd Command, idx string, data et.Json *
func (*Tx) GetCache ¶
* * getCache: Returns the data for the from * @param from *Model * @return []et.Json *
type Where ¶
type Where struct {
From []et.Json `json:"from"`
Conditions []*Condition `json:"conditions"`
Selects []string `json:"selects"`
Joins []string `json:"joins"`
Hiddens []string `json:"hiddens"`
OrderBy map[string]bool `json:"order_by"`
Offset int `json:"offset"`
Limits int `json:"limits"`
Workers int `json:"workers"`
Result []et.Json `json:"result"`
// contains filtered or unexported fields
}
* * Where *
func (*Where) AdddResult ¶
* * AdddResult * @return next bool *