Documentation
¶
Index ¶
- Constants
- Variables
- type ByCreatedAtAsc
- type ByCreatedAtDesc
- type ByObjectTypeAndObjectIdAsc
- type ByObjectTypeAndObjectIdDesc
- type Query
- type QueryHaving
- type QueryListParamParser
- type QueryResponseV1
- type QueryResponseV2
- type QueryResult
- type QueryService
- type Resource
- type ResultSet
- func (rs *ResultSet) Add(objectType string, objectId string, relation string, ...)
- func (rs *ResultSet) Get(objectType string, objectId string, relation string) *ResultSetNode
- func (rs *ResultSet) Has(objectType string, objectId string, relation string) bool
- func (rs *ResultSet) Intersect(other *ResultSet) *ResultSet
- func (rs *ResultSet) Len() int
- func (rs *ResultSet) List() *ResultSetNode
- func (rs *ResultSet) String() string
- func (rs *ResultSet) Union(other *ResultSet) *ResultSet
- type ResultSetNode
- type SelectObjects
- type SelectSubjects
Constants ¶
View Source
const ( MaxObjectTypes = 1000 MaxEdges = 10000 )
View Source
const PrimarySortKey = "id"
Variables ¶
View Source
var ErrInvalidQuery = errors.New("invalid query")
Functions ¶
This section is empty.
Types ¶
type ByCreatedAtAsc ¶ added in v0.57.0
type ByCreatedAtAsc []QueryResult
func (ByCreatedAtAsc) Len ¶ added in v0.57.0
func (res ByCreatedAtAsc) Len() int
func (ByCreatedAtAsc) Less ¶ added in v0.57.0
func (res ByCreatedAtAsc) Less(i, j int) bool
func (ByCreatedAtAsc) Swap ¶ added in v0.57.0
func (res ByCreatedAtAsc) Swap(i, j int)
type ByCreatedAtDesc ¶ added in v0.57.0
type ByCreatedAtDesc []QueryResult
func (ByCreatedAtDesc) Len ¶ added in v0.57.0
func (res ByCreatedAtDesc) Len() int
func (ByCreatedAtDesc) Less ¶ added in v0.57.0
func (res ByCreatedAtDesc) Less(i, j int) bool
func (ByCreatedAtDesc) Swap ¶ added in v0.57.0
func (res ByCreatedAtDesc) Swap(i, j int)
type ByObjectTypeAndObjectIdAsc ¶ added in v0.57.0
type ByObjectTypeAndObjectIdAsc []QueryResult
func (ByObjectTypeAndObjectIdAsc) Len ¶ added in v0.57.0
func (res ByObjectTypeAndObjectIdAsc) Len() int
func (ByObjectTypeAndObjectIdAsc) Less ¶ added in v0.57.0
func (res ByObjectTypeAndObjectIdAsc) Less(i, j int) bool
func (ByObjectTypeAndObjectIdAsc) Swap ¶ added in v0.57.0
func (res ByObjectTypeAndObjectIdAsc) Swap(i, j int)
type ByObjectTypeAndObjectIdDesc ¶ added in v0.57.0
type ByObjectTypeAndObjectIdDesc []QueryResult
func (ByObjectTypeAndObjectIdDesc) Len ¶ added in v0.57.0
func (res ByObjectTypeAndObjectIdDesc) Len() int
func (ByObjectTypeAndObjectIdDesc) Less ¶ added in v0.57.0
func (res ByObjectTypeAndObjectIdDesc) Less(i, j int) bool
func (ByObjectTypeAndObjectIdDesc) Swap ¶ added in v0.57.0
func (res ByObjectTypeAndObjectIdDesc) Swap(i, j int)
type Query ¶
type Query struct {
Expand bool
SelectSubjects *SelectSubjects
SelectObjects *SelectObjects
Context baseWarrant.PolicyContext
// contains filtered or unexported fields
}
func NewQueryFromString ¶
type QueryHaving ¶
type QueryListParamParser ¶
type QueryListParamParser struct{}
func (QueryListParamParser) GetDefaultSortBy ¶
func (parser QueryListParamParser) GetDefaultSortBy() string
func (QueryListParamParser) GetSupportedSortBys ¶
func (parser QueryListParamParser) GetSupportedSortBys() []string
func (QueryListParamParser) ParseValue ¶
func (parser QueryListParamParser) ParseValue(val string, sortBy string) (interface{}, error)
type QueryResponseV1 ¶ added in v0.57.0
type QueryResponseV1 struct {
Results []QueryResult `json:"results"`
LastId string `json:"lastId,omitempty"`
}
type QueryResponseV2 ¶ added in v0.57.0
type QueryResponseV2 struct {
Results []QueryResult `json:"results"`
PrevCursor *service.Cursor `json:"prevCursor,omitempty"`
NextCursor *service.Cursor `json:"nextCursor,omitempty"`
}
type QueryResult ¶
type QueryResult struct {
ObjectType string `json:"objectType"`
ObjectId string `json:"objectId"`
Relation string `json:"-"`
Warrant baseWarrant.WarrantSpec `json:"warrant"`
IsImplicit bool `json:"isImplicit"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
type QueryService ¶
type QueryService struct {
service.BaseService
// contains filtered or unexported fields
}
func NewService ¶
func NewService(env service.Env, objectTypeSvc objecttype.Service, warrantSvc warrant.Service, objectSvc object.Service) QueryService
func (QueryService) Query ¶
func (svc QueryService) Query(ctx context.Context, query Query, listParams service.ListParams) ([]QueryResult, *service.Cursor, *service.Cursor, error)
type ResultSet ¶
type ResultSet struct {
// contains filtered or unexported fields
}
func NewResultSet ¶
func NewResultSet() *ResultSet
func (*ResultSet) Get ¶
func (rs *ResultSet) Get(objectType string, objectId string, relation string) *ResultSetNode
func (*ResultSet) List ¶
func (rs *ResultSet) List() *ResultSetNode
type ResultSetNode ¶
type ResultSetNode struct {
ObjectType string
ObjectId string
Relation string
Warrant warrant.WarrantSpec
IsImplicit bool
// contains filtered or unexported fields
}
func (ResultSetNode) Next ¶
func (node ResultSetNode) Next() *ResultSetNode
type SelectObjects ¶
func (SelectObjects) String ¶ added in v1.8.1
func (s SelectObjects) String() string
type SelectSubjects ¶
func (SelectSubjects) String ¶ added in v1.8.1
func (s SelectSubjects) String() string
Click to show internal directories.
Click to hide internal directories.