Documentation ¶
Index ¶
- type Base
- type FieldValue
- type Principal
- type PrincipalMatchingAttribute
- type QueryOption
- func WithFilter(filter map[string]FieldValue) QueryOption
- func WithJoin(joins ...string) QueryOption
- func WithPage(page int64) QueryOption
- func WithPreloads(preloads ...string) QueryOption
- func WithSize(size int64) QueryOption
- func WithSkipPagination() QueryOption
- func WithSort(sort string) QueryOption
- type Repositories
- type Resource
- type ResourceMatchingAttribute
- type ResourceQueryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base[T model.Models] interface { Create(object ...*T) error DB() *gorm.DB Delete(object *T) error DeleteByFields(fieldValues map[string]FieldValue) error Find(options ...QueryOption) ([]*T, int64, error) Get(identifier string, options ...QueryOption) (*T, error) GetByFields(fieldValues map[string]FieldValue, options ...QueryOption) (*T, error) Update(object *T) error UpdateAssociation(object *T, associationName string, data any) error WithTransaction(transaction database.Transaction) *base[T] }
type FieldValue ¶
type Principal ¶
type QueryOption ¶
type QueryOption func(*queryOptions)
QueryOption specifies how options should be formatted.
An option is a function that takes this private struct and override values on it.
func WithFilter ¶
func WithFilter(filter map[string]FieldValue) QueryOption
WithFilter allows to specify some filters to apply on the query.
func WithJoin ¶
func WithJoin(joins ...string) QueryOption
func WithPage ¶
func WithPage(page int64) QueryOption
WithPage allows to specify the page number you want to retrieve.
func WithPreloads ¶
func WithPreloads(preloads ...string) QueryOption
WithPreloads allows to specify relationships you want to preload with the currently requested resource.
func WithSize ¶
func WithSize(size int64) QueryOption
WithSize allows to specify the size (number of elements) you want to retrieve.
func WithSkipPagination ¶
func WithSkipPagination() QueryOption
WithSkipPagination allows to skip pagination and retrieve all elements.
func WithSort ¶
func WithSort(sort string) QueryOption
WithSort allows to specify the sort order you want to apply on the query.
type Repositories ¶
type Repositories interface { base[model.Action] | base[model.Client] | base[model.CompiledPolicy] | base[model.Policy] | base[model.Principal] | base[model.Resource] | base[model.Role] | base[model.User] | resource }
Repositories is a constraint interface that allows only authz library repositories.
type Resource ¶
type Resource interface { Base[model.Resource] FindMatchingAttribute(resourceAttribute string, options ...ResourceQueryOption) ([]*ResourceMatchingAttribute, error) }
type ResourceQueryOption ¶
type ResourceQueryOption func(*resourceQueryOptions)
func WithResourceIDs ¶
func WithResourceIDs(resourceIDs []string) ResourceQueryOption