Documentation
¶
Index ¶
- Variables
- func BoolPtrFromNullableBool(sqlBool sql.NullBool) *bool
- func IntPtrFromNullableInt(i sql.NullInt32) *int
- func JSONRawMessageFromNullableString(sqlString sql.NullString) json.RawMessage
- func NewNullableBool(boolean *bool) sql.NullBool
- func NewNullableInt(i *int) sql.NullInt32
- func NewNullableString(text *string) sql.NullString
- func NewNullableStringFromJSONRawMessage(json json.RawMessage) sql.NullString
- func NewValidNullableBool(boolean bool) sql.NullBool
- func NewValidNullableString(text string) sql.NullString
- func StringPtrFromNullableString(sqlString sql.NullString) *string
- type BaseEntity
- func (e *BaseEntity) GetCreatedAt() time.Time
- func (e *BaseEntity) GetDeletedAt() time.Time
- func (e *BaseEntity) GetError() sql.NullString
- func (e *BaseEntity) GetReady() bool
- func (e *BaseEntity) GetUpdatedAt() time.Time
- func (e *BaseEntity) SetCreatedAt(t time.Time)
- func (e *BaseEntity) SetDeletedAt(t time.Time)
- func (e *BaseEntity) SetError(err sql.NullString)
- func (e *BaseEntity) SetReady(ready bool)
- func (e *BaseEntity) SetUpdatedAt(t time.Time)
- type Collection
- type Condition
- func NewEqualCondition(field string, val interface{}) Condition
- func NewInConditionForStringValues(field string, values []string) Condition
- func NewInConditionForSubQuery(field, subQuery string, args []interface{}) Condition
- func NewJSONArrAnyMatchCondition(field string, val []interface{}) Condition
- func NewJSONArrMatchAnyStringCondition(field string, values ...string) Condition
- func NewJSONCondition(field string, val interface{}) Condition
- func NewNotEqualCondition(field string, val interface{}) Condition
- func NewNotNullCondition(field string) Condition
- func NewNotRegexConditionString(field string, value string) Condition
- func NewNullCondition(field string) Condition
- func NewTenantIsolationCondition(field string, val interface{}) Condition
- func NewTenantIsolationConditionWithPlaceholder(field string, placeholder string, args []interface{}) Condition
- type Conditions
- type Creator
- type Deleter
- type DeleterGlobal
- type Entity
- type ExistQuerier
- type ExistQuerierGlobal
- type GroupByParams
- type Lister
- type ListerGlobal
- type OrderBy
- type OrderByDir
- type OrderByParams
- type PageableQuerier
- type PageableQuerierGlobal
- type QueryBuilder
- type SingleGetter
- type SingleGetterGlobal
- type UnionLister
- type Updater
- type UpdaterGlobal
- type Upserter
Constants ¶
This section is empty.
Variables ¶
var NoOrderBy = OrderByParams{}
NoOrderBy represents default ordering (no order specified)
Functions ¶
func BoolPtrFromNullableBool ¶
BoolPtrFromNullableBool missing godoc
func IntPtrFromNullableInt ¶
IntPtrFromNullableInt missing godoc
func JSONRawMessageFromNullableString ¶
func JSONRawMessageFromNullableString(sqlString sql.NullString) json.RawMessage
JSONRawMessageFromNullableString missing godoc
func NewNullableBool ¶
NewNullableBool missing godoc
func NewNullableString ¶
func NewNullableString(text *string) sql.NullString
NewNullableString missing godoc
func NewNullableStringFromJSONRawMessage ¶
func NewNullableStringFromJSONRawMessage(json json.RawMessage) sql.NullString
NewNullableStringFromJSONRawMessage missing godoc
func NewValidNullableBool ¶
NewValidNullableBool missing godoc
func NewValidNullableString ¶
func NewValidNullableString(text string) sql.NullString
NewValidNullableString missing godoc
func StringPtrFromNullableString ¶
func StringPtrFromNullableString(sqlString sql.NullString) *string
StringPtrFromNullableString missing godoc
Types ¶
type BaseEntity ¶
type BaseEntity struct { ID string `db:"id"` Ready bool `db:"ready"` CreatedAt *time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` Error sql.NullString `db:"error"` }
BaseEntity missing godoc
func (*BaseEntity) GetCreatedAt ¶
func (e *BaseEntity) GetCreatedAt() time.Time
GetCreatedAt missing godoc
func (*BaseEntity) GetDeletedAt ¶
func (e *BaseEntity) GetDeletedAt() time.Time
GetDeletedAt missing godoc
func (*BaseEntity) GetUpdatedAt ¶
func (e *BaseEntity) GetUpdatedAt() time.Time
GetUpdatedAt missing godoc
func (*BaseEntity) SetCreatedAt ¶
func (e *BaseEntity) SetCreatedAt(t time.Time)
SetCreatedAt missing godoc
func (*BaseEntity) SetDeletedAt ¶
func (e *BaseEntity) SetDeletedAt(t time.Time)
SetDeletedAt missing godoc
func (*BaseEntity) SetError ¶
func (e *BaseEntity) SetError(err sql.NullString)
SetError missing godoc
func (*BaseEntity) SetUpdatedAt ¶
func (e *BaseEntity) SetUpdatedAt(t time.Time)
SetUpdatedAt missing godoc
type Condition ¶
type Condition interface { // GetQueryPart returns formatted string that will be included in the SQL query for a given condition GetQueryPart() string // GetQueryArg returns a boolean flag if the condition contains argument and the argument value // // For conditions like IN and IS NOT NULL there are no arguments to be included in the query. // For conditions like = there is a placeholder which value will be returned calling this func. GetQueryArgs() ([]interface{}, bool) }
Condition missing godoc
func NewEqualCondition ¶
NewEqualCondition missing godoc
func NewInConditionForStringValues ¶
NewInConditionForStringValues missing godoc
func NewInConditionForSubQuery ¶
NewInConditionForSubQuery missing godoc
func NewJSONArrAnyMatchCondition ¶
NewJSONArrAnyMatchCondition missing godoc
func NewJSONArrMatchAnyStringCondition ¶
NewJSONArrMatchAnyStringCondition missing godoc
func NewJSONCondition ¶
NewJSONCondition missing godoc
func NewNotEqualCondition ¶
NewNotEqualCondition missing godoc
func NewNotNullCondition ¶
NewNotNullCondition missing godoc
func NewNotRegexConditionString ¶
NewNotRegexConditionString missing godoc
func NewNullCondition ¶
NewNullCondition missing godoc
func NewTenantIsolationCondition ¶
NewTenantIsolationCondition returns a repo condition filtering all resources based on the tenant provided (recursively iterating over all the child tenants)
func NewTenantIsolationConditionWithPlaceholder ¶
func NewTenantIsolationConditionWithPlaceholder(field string, placeholder string, args []interface{}) Condition
NewTenantIsolationConditionWithPlaceholder return tenant isolation repo condition with different tenant_id input placeholder. This is needed for update sql queries where the tenant_id to search for is not provided as an argument, but is used from the entity being updated.
type Deleter ¶
type Deleter interface { DeleteOne(ctx context.Context, tenant string, conditions Conditions) error DeleteMany(ctx context.Context, tenant string, conditions Conditions) error }
Deleter missing godoc
type DeleterGlobal ¶
type DeleterGlobal interface { DeleteOneGlobal(ctx context.Context, conditions Conditions) error DeleteManyGlobal(ctx context.Context, conditions Conditions) error }
DeleterGlobal missing godoc
func NewDeleterGlobal ¶
func NewDeleterGlobal(resourceType resource.Type, tableName string) DeleterGlobal
NewDeleterGlobal missing godoc
type Entity ¶
type Entity interface { GetReady() bool SetReady(ready bool) GetCreatedAt() time.Time SetCreatedAt(t time.Time) GetUpdatedAt() time.Time SetUpdatedAt(t time.Time) GetDeletedAt() time.Time SetDeletedAt(t time.Time) GetError() sql.NullString SetError(err sql.NullString) }
Entity denotes an DB-layer entity which can be timestamped with created_at, updated_at, deleted_at and ready values
type ExistQuerier ¶
type ExistQuerier interface {
Exists(ctx context.Context, tenant string, conditions Conditions) (bool, error)
}
ExistQuerier missing godoc
func NewExistQuerier ¶
func NewExistQuerier(resourceType resource.Type, tableName string, tenantColumn string) ExistQuerier
NewExistQuerier missing godoc
type ExistQuerierGlobal ¶
type ExistQuerierGlobal interface {
ExistsGlobal(ctx context.Context, conditions Conditions) (bool, error)
}
ExistQuerierGlobal missing godoc
func NewExistQuerierGlobal ¶
func NewExistQuerierGlobal(resourceType resource.Type, tableName string) ExistQuerierGlobal
NewExistQuerierGlobal missing godoc
type Lister ¶
type Lister interface { List(ctx context.Context, tenant string, dest Collection, additionalConditions ...Condition) error SetSelectedColumns(selectedColumns []string) Clone() Lister }
Lister missing godoc
func NewLister ¶
func NewLister(resourceType resource.Type, tableName string, tenantColumn string, selectedColumns []string) Lister
NewLister missing godoc
func NewListerWithOrderBy ¶
func NewListerWithOrderBy(resourceType resource.Type, tableName string, tenantColumn string, selectedColumns []string, orderByParams OrderByParams) Lister
NewListerWithOrderBy missing godoc
type ListerGlobal ¶
type ListerGlobal interface {
ListGlobal(ctx context.Context, dest Collection, additionalConditions ...Condition) error
}
ListerGlobal missing godoc
func NewListerGlobal ¶
func NewListerGlobal(resourceType resource.Type, tableName string, selectedColumns []string) ListerGlobal
NewListerGlobal missing godoc
type OrderBy ¶
type OrderBy struct { Field string Dir OrderByDir }
OrderBy type that wraps the information about the ordering column and direction
func NewAscOrderBy ¶
NewAscOrderBy returns wrapping type for ascending order for a given column (field)
func NewDescOrderBy ¶
NewDescOrderBy returns wrapping type for descending orderd for a given column (field)
type OrderByDir ¶
type OrderByDir string
OrderByDir is a type encapsulating the ORDER BY direction
const ( // AscOrderBy defines ascending order AscOrderBy OrderByDir = "ASC" // DescOrderBy defines descending order DescOrderBy OrderByDir = "DESC" )
type OrderByParams ¶
type OrderByParams []OrderBy
OrderByParams is a wrapping type for slice of OrderBy types
type PageableQuerier ¶
type PageableQuerier interface {
List(ctx context.Context, tenant string, pageSize int, cursor string, orderByColumn string, dest Collection, additionalConditions ...Condition) (*pagination.Page, int, error)
}
PageableQuerier missing godoc
func NewPageableQuerier ¶
func NewPageableQuerier(resourceType resource.Type, tableName string, tenantColumn string, selectedColumns []string) PageableQuerier
NewPageableQuerier missing godoc
type PageableQuerierGlobal ¶
type PageableQuerierGlobal interface {
ListGlobal(ctx context.Context, pageSize int, cursor string, orderByColumn string, dest Collection, additionalConditions ...Condition) (*pagination.Page, int, error)
}
PageableQuerierGlobal missing godoc
func NewPageableQuerierGlobal ¶
func NewPageableQuerierGlobal(resourceType resource.Type, tableName string, selectedColumns []string) PageableQuerierGlobal
NewPageableQuerierGlobal missing godoc
type QueryBuilder ¶
type QueryBuilder interface {
BuildQuery(tenantID string, isRebindingNeeded bool, conditions ...Condition) (string, []interface{}, error)
}
QueryBuilder missing godoc
func NewQueryBuilder ¶
func NewQueryBuilder(resourceType resource.Type, tableName string, tenantColumn string, selectedColumns []string) QueryBuilder
NewQueryBuilder missing godoc
type SingleGetter ¶
type SingleGetter interface {
Get(ctx context.Context, tenant string, conditions Conditions, orderByParams OrderByParams, dest interface{}) error
}
SingleGetter missing godoc
func NewSingleGetter ¶
func NewSingleGetter(resourceType resource.Type, tableName string, tenantColumn string, selectedColumns []string) SingleGetter
NewSingleGetter missing godoc
type SingleGetterGlobal ¶
type SingleGetterGlobal interface {
GetGlobal(ctx context.Context, conditions Conditions, orderByParams OrderByParams, dest interface{}) error
}
SingleGetterGlobal missing godoc
func NewSingleGetterGlobal ¶
func NewSingleGetterGlobal(resourceType resource.Type, tableName string, selectedColumns []string) SingleGetterGlobal
NewSingleGetterGlobal missing godoc
type UnionLister ¶
type UnionLister interface { // List stores the result into dest and returns the total count of tuples for each id from ids List(ctx context.Context, tenant string, ids []string, idsColumn string, pageSize int, cursor string, orderBy OrderByParams, dest Collection, additionalConditions ...Condition) (map[string]int, error) SetSelectedColumns(selectedColumns []string) Clone() UnionLister }
UnionLister missing godoc
func NewUnionLister ¶
func NewUnionLister(resourceType resource.Type, tableName string, tenantColumn string, selectedColumns []string) UnionLister
NewUnionLister missing godoc
type Updater ¶
type Updater interface { UpdateSingle(ctx context.Context, dbEntity interface{}) error SetIDColumns(idColumns []string) SetUpdatableColumns(updatableColumns []string) Clone() Updater TechnicalUpdate(ctx context.Context, dbEntity interface{}) error }
Updater missing godoc
type UpdaterGlobal ¶
type UpdaterGlobal interface {
UpdateSingleGlobal(ctx context.Context, dbEntity interface{}) error
}
UpdaterGlobal missing godoc
func NewUpdaterGlobal ¶
func NewUpdaterGlobal(resourceType resource.Type, tableName string, updatableColumns []string, idColumns []string) UpdaterGlobal
NewUpdaterGlobal missing godoc