Documentation ¶
Index ¶
- Constants
- func AddUniqueMetaOwnerReference(res Resource, ownerRef *meta.OwnerReference) bool
- func ApplyPagerToViewUsingOffset(pager PagerQuery, view ResourceList) (pagedView ResourceList, nextPageCursor, prevPageCursor Cursor)
- func ApplyPagerToViewUsingSnapshot(pager PagerQuery, view ResourceList) (pagedView ResourceList, nextPageCursor, prevPageCursor Cursor)
- func FindMetaOwnerByDescriptor(res Resource, descriptor Descriptor) (mref *meta.OwnerReference)
- func FindMultiRegionPolicyFieldPath(resDescriptor Descriptor) object.FieldPath
- func GenerateResourceId(res Resource) string
- func GenerateResourceIdFromElements(elements ...string) string
- func GetCount(ctx context.Context, desc Descriptor, access Access, filter Filter) (int32, error)
- func GetSyncingOpts(descriptor Descriptor) *mrann.SyncingOpts
- func HasForwardCursor(pager PagerQuery, view ResourceList) bool
- func IsRegionalResource(descriptor Descriptor) bool
- func IterateListQuery(ctx context.Context, query ListQuery, access Access, ...) error
- func MakeMetaOwnerReference(owner Resource, flags ...OwnerRefFlag) *meta.OwnerReference
- func MakeMetaOwnerReferenceFromNameAndRegion(ownerName Name, ownerRegionId string, flags ...OwnerRefFlag) *meta.OwnerReference
- func MakeSQLGetString(query GetQuery) string
- func MakeSQLListString(query ListQuery) string
- func MakeSQLSearchString(query SearchQuery) string
- func MakeSQLWatchString(query WatchQuery) string
- func MarshalQueryResultChange(qres QueryResultChange) ([]byte, error)
- func MarshalQueryResultSnapshot(qres QueryResultSnapshot) ([]byte, error)
- func NewUnknownConditionContainsType(ct ConditionContainsType) error
- func SortedResourceIdRefNameSegments(descriptor Descriptor) []string
- func UnmarshalQueryResultChange(qres QueryResultChange, descriptor Descriptor, data []byte) error
- func UnmarshalQueryResultSnapshot(qres QueryResultSnapshot, descriptor Descriptor, data []byte) error
- func UnsetReferenceFromResource(res Resource, refFp object.FieldPath, refToUnset Reference) bool
- type Access
- type BatchGetOption
- type BatchGetOptions
- type ChangesWatchPager
- type ConditionCompare
- type ConditionComposite
- type ConditionContains
- type ConditionContainsType
- type ConditionIn
- type ConditionIsNaN
- type ConditionIsNull
- type ConditionNot
- type ConditionNotIn
- type Cursor
- type CursorInclusion
- type CursorValue
- type CursorValueType
- type CustomCursorValue
- type DeleteOption
- type DeleteOptions
- type Descriptor
- type DisplayableResource
- type FieldPathCondition
- type Filter
- type FilterCondition
- type GetOption
- type GetOptions
- type GetQuery
- type ListQuery
- type Name
- type NameDescriptor
- func (d *NameDescriptor) GetAllSegmentIdFieldNames() []string
- func (d *NameDescriptor) GetFieldPath() object.FieldPath
- func (d *NameDescriptor) GetIdFieldName() string
- func (d *NameDescriptor) GetNamePatterns() []NamePattern
- func (d *NameDescriptor) GetParentIdFieldNames() []string
- func (d *NameDescriptor) GetPatternFieldName() string
- type NameList
- type NamePattern
- type NameSegment
- type NameSegmentPattern
- type NameSegmentPatterns
- type NameSegments
- type OffsetCursorValue
- func (ocp *OffsetCursorValue) GetOffset() int32
- func (ocp *OffsetCursorValue) GetValueType() CursorValueType
- func (ocp *OffsetCursorValue) MakeBackwardValue(direction PageDirection, advanceBy int32) *OffsetCursorValue
- func (ocp *OffsetCursorValue) MakeForwardValue(direction PageDirection, advanceBy int32) *OffsetCursorValue
- func (ocp *OffsetCursorValue) String() string
- type OrderBy
- type OrderByField
- type OrderDirection
- type OwnerRefFlag
- type PageDirection
- type PagerQuery
- type ParentNameList
- type ParentReferenceList
- type Query
- type QueryOption
- type QueryOptions
- type QueryResultChange
- type QueryResultSnapshot
- type Reference
- type ReferenceList
- type Registry
- type Resource
- type ResourceChange
- type ResourceChangeList
- type ResourceChangeMap
- type ResourceList
- type ResourceMap
- type SaveOption
- type SaveOptions
- type SearchQuery
- type SnapshotCursorValue
- type TypeName
- type UnknownConditionContainsType
- type WatchQuery
Constants ¶
const ( ConditionContainsTypeUnspecified = iota ConditionContainsTypeValue ConditionContainsTypeAny ConditionContainsTypeAll )
const (
DefaultMaximumQueryChunkSize = 100
)
const (
InConditionsMaxArgs = 10
)
const (
RegionScopeAttribute = "goten.annotations/Region"
)
const (
WildcardId = "-"
)
Variables ¶
This section is empty.
Functions ¶
func AddUniqueMetaOwnerReference ¶ added in v1.0.0
func AddUniqueMetaOwnerReference(res Resource, ownerRef *meta.OwnerReference) bool
func ApplyPagerToViewUsingOffset ¶
func ApplyPagerToViewUsingOffset(pager PagerQuery, view ResourceList) (pagedView ResourceList, nextPageCursor, prevPageCursor Cursor)
ApplyPagerToViewUsingOffset creates next and prev page cursors by checking offset. Forward cursor will be empty, if insufficient results are present. Backward cursor will be reversed version of previous cursor (may be empty). Cursors are computed based on offset from the beginning of array. In other words, CursorValueType will be of OffsetCursorValueType. View will be adjusted to the pager too.
func ApplyPagerToViewUsingSnapshot ¶
func ApplyPagerToViewUsingSnapshot(pager PagerQuery, view ResourceList) (pagedView ResourceList, nextPageCursor, prevPageCursor Cursor)
ApplyPagerToViewUsingSnapshot creates next and prev page cursors for slice of results. Forward cursor will be empty, if insufficient results are present. Backward cursor will be reversed version of previous cursor (empty if not set). Cursors are built based on resource snapshot taken from the view - taken from the end if pager points right, otherwise from beginning. In other words, CursorValueType will be of SnapshotCursorValueType. View will be adjusted to the pager too.
func FindMetaOwnerByDescriptor ¶ added in v1.0.0
func FindMetaOwnerByDescriptor(res Resource, descriptor Descriptor) (mref *meta.OwnerReference)
func FindMultiRegionPolicyFieldPath ¶ added in v1.5.13
func FindMultiRegionPolicyFieldPath(resDescriptor Descriptor) object.FieldPath
func GenerateResourceId ¶
func GenerateResourceIdFromElements ¶ added in v0.9.11
func GetSyncingOpts ¶ added in v1.5.13
func GetSyncingOpts(descriptor Descriptor) *mrann.SyncingOpts
func HasForwardCursor ¶
func HasForwardCursor(pager PagerQuery, view ResourceList) bool
HasForwardCursor returns information view is long enough to justify presence of forward cursor
func IsRegionalResource ¶ added in v1.5.13
func IsRegionalResource(descriptor Descriptor) bool
func IterateListQuery ¶ added in v0.4.39
func MakeMetaOwnerReference ¶ added in v1.0.0
func MakeMetaOwnerReference(owner Resource, flags ...OwnerRefFlag) *meta.OwnerReference
func MakeMetaOwnerReferenceFromNameAndRegion ¶ added in v1.0.0
func MakeMetaOwnerReferenceFromNameAndRegion(ownerName Name, ownerRegionId string, flags ...OwnerRefFlag) *meta.OwnerReference
func MakeSQLGetString ¶
func MakeSQLListString ¶ added in v0.4.28
func MakeSQLSearchString ¶ added in v0.4.28
func MakeSQLSearchString(query SearchQuery) string
func MakeSQLWatchString ¶ added in v0.4.28
func MakeSQLWatchString(query WatchQuery) string
func MarshalQueryResultChange ¶ added in v0.4.28
func MarshalQueryResultChange(qres QueryResultChange) ([]byte, error)
func MarshalQueryResultSnapshot ¶
func MarshalQueryResultSnapshot(qres QueryResultSnapshot) ([]byte, error)
func NewUnknownConditionContainsType ¶
func NewUnknownConditionContainsType(ct ConditionContainsType) error
func SortedResourceIdRefNameSegments ¶ added in v0.8.0
func SortedResourceIdRefNameSegments(descriptor Descriptor) []string
func UnmarshalQueryResultChange ¶ added in v0.4.28
func UnmarshalQueryResultChange(qres QueryResultChange, descriptor Descriptor, data []byte) error
func UnmarshalQueryResultSnapshot ¶
func UnmarshalQueryResultSnapshot(qres QueryResultSnapshot, descriptor Descriptor, data []byte) error
Types ¶
type Access ¶
type Access interface { // Get returns single resource. Raises NotFound grpc error if // resource is not found. Get(ctx context.Context, q GetQuery, opts ...GetOption) (Resource, error) // Query returns snapshot of resources within given query spec. Query(ctx context.Context, q ListQuery, opts ...QueryOption) (QueryResultSnapshot, error) // Search is like Query, but also provides results based on text-search Search(ctx context.Context, q SearchQuery, opts ...QueryOption) (QueryResultSnapshot, error) // Watch is blocking call till is finished or error occurred. // Initially, provides ResourceChange of Add type containing full // resource state (minus provided field mask). Then it contains single // changes only. Watch(ctx context.Context, q GetQuery, cb func(ch ResourceChange) error) error // WatchQuery is blocking call till is finished or error occurred. // Initially provides snapshot of query like would be returned for Query. // Then it returns changes as they happen. WatchQuery(ctx context.Context, q WatchQuery, cb func(ch QueryResultChange) error) error // Save creates/updates single resource Save(ctx context.Context, res Resource, opts ...SaveOption) error // Delete removes single resource Delete(ctx context.Context, ref Reference, opts ...DeleteOption) error // BatchGet resolves passed references all at once. // References pointing to non-existent resources won't be resolved. // In order to ensure all references are resolved, use WithMustResolveAll // option BatchGet(ctx context.Context, toGet []Reference, opts ...BatchGetOption) error // GetResourceDescriptors returns all supported resource descriptors under this Access GetResourceDescriptors() []Descriptor }
Access is an interface allowing basic interaction with set of supported resources
func NewCompositeAccess ¶
NewCompositeAccess constructs Access over multiple smaller ones
type BatchGetOption ¶
type BatchGetOption func(*batchGetOptions)
func WithBatchGetFieldMask ¶ added in v0.9.0
func WithBatchGetFieldMask(desc Descriptor, mask object.FieldMask) BatchGetOption
func WithBatchGetSkipCache ¶ added in v1.6.8
func WithBatchGetSkipCache() BatchGetOption
func WithMustResolveAll ¶
func WithMustResolveAll() BatchGetOption
type BatchGetOptions ¶
type BatchGetOptions interface { MustResolveAll() bool GetFieldMask(Descriptor) object.FieldMask GetFieldMasks() map[Descriptor]object.FieldMask GetSkipCache() bool }
func MakeBatchGetOptions ¶
func MakeBatchGetOptions(opts []BatchGetOption) BatchGetOptions
type ChangesWatchPager ¶
type ChangesWatchPager struct {
// contains filtered or unexported fields
}
ChangesWatchPager is a helper stateful object containing cached view to inform of page token changes. It should be used in conjunction with stateful watch methods only if cursor values are based on resource snapshot. In offset-based queries, cursors never change so there is no equivalent structure for it.
func NewChangesWatchPager ¶
func NewChangesWatchPager(pager PagerQuery, descriptor Descriptor) *ChangesWatchPager
func (*ChangesWatchPager) ProcessChanges ¶
func (wp *ChangesWatchPager) ProcessChanges(changes ResourceChangeList) (Cursor, Cursor, bool)
ProcessChanges adjust view of page and returns new cursors (next and prev page) when they need to be updated
type ConditionCompare ¶
type ConditionCompare interface { FieldPathCondition GetOperator() filterParser.CompareOperator GetRawFieldPathValue() object.FieldPathValue ConditionCompare() }
type ConditionComposite ¶
type ConditionComposite interface { FilterCondition GetOperator() filterParser.CompositeOperator GetSubConditions() []FilterCondition ConditionComposite() }
type ConditionContains ¶
type ConditionContains interface { FieldPathCondition ConditionContainsType() ConditionContainsType GetRawFieldPathItemValue() object.FieldPathArrayItemValue // Value GetRawFieldPathItemValues() []object.FieldPathArrayItemValue // Any | All }
type ConditionContainsType ¶
type ConditionContainsType int
func ConditionContainsTypeFromParser ¶
func ConditionContainsTypeFromParser(contains *filterParser.Contains) ConditionContainsType
func (ConditionContainsType) IsAll ¶
func (cct ConditionContainsType) IsAll() bool
func (ConditionContainsType) IsAny ¶
func (cct ConditionContainsType) IsAny() bool
func (ConditionContainsType) IsValue ¶
func (cct ConditionContainsType) IsValue() bool
func (ConditionContainsType) String ¶
func (cct ConditionContainsType) String() string
type ConditionIn ¶
type ConditionIn interface { FieldPathCondition GetRawFieldPathArrayOfValues() object.FieldPathArrayOfValues ConditionIn() }
type ConditionIsNaN ¶
type ConditionIsNaN interface { FieldPathCondition GetRawFieldPath() object.FieldPath ConditionIsNaN() }
type ConditionIsNull ¶
type ConditionIsNull interface { FieldPathCondition NotNull() bool GetRawFieldPath() object.FieldPath ConditionIsNull() }
type ConditionNot ¶
type ConditionNot interface { FilterCondition GetSubCondition() FilterCondition ConditionNot() }
type ConditionNotIn ¶
type ConditionNotIn interface { FieldPathCondition GetRawFieldPathArrayOfValues() object.FieldPathArrayOfValues ConditionNotIn() }
type Cursor ¶
type Cursor interface { fmt.Stringer preflect.ProtoStringer IsEmpty() bool GetPageDirection() PageDirection GetInclusion() CursorInclusion GetValue() CursorValue SetPageDirection(PageDirection) SetInclusion(CursorInclusion) SetCursorValue(CursorValue) }
Cursor wraps information about point in database index, direction and inclusiveness.
type CursorInclusion ¶
type CursorInclusion string
const ( CursorInclusive CursorInclusion = "i" CursorExclusive CursorInclusion = "e" )
func CursorInclusionFromString ¶
func CursorInclusionFromString(str string) (result CursorInclusion, err error)
func (CursorInclusion) IsExclusive ¶
func (ci CursorInclusion) IsExclusive() bool
func (CursorInclusion) IsInclusive ¶
func (ci CursorInclusion) IsInclusive() bool
func (CursorInclusion) Reverse ¶
func (ci CursorInclusion) Reverse() CursorInclusion
type CursorValue ¶
type CursorValue interface { fmt.Stringer GetValueType() CursorValueType }
CursorValue is implementation-specific holder of value indicating position of the cursor in database index.
type CursorValueType ¶
type CursorValueType string
const ( UnIdentifiedCursorValue CursorValueType = "" SnapshotCursorValueType CursorValueType = "S" OffsetCursorValueType CursorValueType = "O" CustomCursorValueType CursorValueType = "C" )
type CustomCursorValue ¶
CustomCursorValue uses custom-made params as a way to indicate point in database for Cursor. It can be used by any backend in a way it likes.
func NewCustomCursorValue ¶
func NewCustomCursorValue() *CustomCursorValue
func ParseCustomCursorValue ¶
func ParseCustomCursorValue(strValue string) (*CustomCursorValue, error)
func (*CustomCursorValue) GetValueType ¶
func (occ *CustomCursorValue) GetValueType() CursorValueType
func (*CustomCursorValue) String ¶
func (occ *CustomCursorValue) String() string
type DeleteOption ¶
type DeleteOption func(*deleteOptions)
func WithCurrentResource ¶
func WithCurrentResource(current Resource) DeleteOption
type DeleteOptions ¶
type DeleteOptions interface {
GetDeletedResource() Resource
}
func MakeDeleteOptions ¶
func MakeDeleteOptions(opts []DeleteOption) DeleteOptions
type Descriptor ¶
type Descriptor interface { NewResource() Resource NewResourceChange() ResourceChange NewResourceName() Name NewResourceCursor() Cursor NewResourceFilter() Filter NewResourceOrderBy() OrderBy NewResourcePager() PagerQuery NewResourceFieldMask() object.FieldMask NewGetQuery() GetQuery NewListQuery() ListQuery NewSearchQuery() SearchQuery NewWatchQuery() WatchQuery NewQueryResultSnapshot() QueryResultSnapshot NewQueryResultChange() QueryResultChange NewResourceList(size, reserved int) ResourceList NewResourceChangeList(size, reserved int) ResourceChangeList NewNameList(size, reserved int) NameList NewReferenceList(size, reserved int) ReferenceList NewParentNameList(size, reserved int) ParentNameList NewParentReferenceList(size, reserved int) ParentReferenceList NewResourceMap(reserved int) ResourceMap NewResourceChangeMap(reserved int) ResourceChangeMap GetResourceTypeName() *TypeName GetNameDescriptor() *NameDescriptor CanBeParentless() bool GetParentResDescriptors() []Descriptor SupportsMetadata() bool SupportsDbConstraints() bool // ParseFieldPath returns a field path matching given string. If does not exist, error // is returned and returned interface is None. ParseFieldPath(raw string) (object.FieldPath, error) ParseResourceName(raw string) (Name, error) }
Descriptor allows writing code operating on resources without knowing exact type. It can be used to create Resource instance, all derivative types, access information about name type.
type DisplayableResource ¶
type FieldPathCondition ¶
type FieldPathCondition interface { FilterCondition GetRawFieldPath() object.FieldPath }
type Filter ¶
type Filter interface { fmt.Stringer preflect.ProtoStringer EvaluateRaw(Resource) bool GetRawCondition() FilterCondition }
Interface for goten filter
type FilterCondition ¶
type GetOption ¶ added in v1.6.8
type GetOption func(*getOptions)
func WithGetSkipCache ¶ added in v1.6.8
func WithGetSkipCache() GetOption
type GetOptions ¶ added in v1.6.8
type GetOptions interface {
GetSkipCache() bool
}
func MakeGetOptions ¶ added in v1.6.8
func MakeGetOptions(opts []GetOption) GetOptions
type ListQuery ¶
type ListQuery interface { Query GetFilter() Filter GetPager() PagerQuery GetFieldMask() object.FieldMask GetWithPagingInfo() bool SetFilter(Filter) SetPager(PagerQuery) SetFieldMask(object.FieldMask) SetWithPagingInfo(bool) }
func MakeCountQuery ¶ added in v1.0.0
func MakeCountQuery(desc Descriptor, filter Filter) ListQuery
type Name ¶
type Name interface { fmt.Stringer preflect.ProtoStringer // SetFromSegments modifies ids and pattern using given segments SetFromSegments(segments NameSegments) error // GotenEqual tells if other object is of same type and // is equal to current Name. GotenEqual(other interface{}) bool // Matches tells if other object is an object of // same type and is at least as specific as // current Name. Matches(other interface{}) bool // IsSpecified informs if Name has active pattern and all segments provided (can be wildcards) IsSpecified() bool // IsFullyQualified informs if Name has all id segments filled according // to it's active pattern without wildcards. Non-Fully Qualified Names can be used as path filters IsFullyQualified() bool // FullyQualifiedName gives resource name with service identifier // If IsFullyQualified is not true, then error will be returned. // Format is: "//($SERVICE_NAME)/($RESOURCE_NAME), where $RESOURCE_NAME is equal to output of method String() FullyQualifiedName() (string, error) // AsRawReference makes a new reference out of this name AsRawReference() Reference // GetResourceDescriptor returns associated with resource GetResourceDescriptor() Descriptor // GetPattern returns active pattern GetPattern() NamePattern // GetIdParts returns IDs for all possible name segments. // If name object does not contain some segment (is not fully specified OR segment is not present in // the active pattern), then value for given key is an empty string. GetIdParts() map[string]string // GetSegments returns list of segments according to the active name pattern GetSegments() NameSegments // GetIParentName returns parent name field from current name (nil, if this is already parent name or // resource cannot have any parent at all). // Unlike GetIUnderlyingParentName, returned object is still bound to the same resource. In other words, go type // is actually of ParentName struct type - not actual name of the parent! GetIParentName() Name // GetIUnderlyingParentName returns parent name according to current name pattern or NIL if it has no parent // (either pattern points to nil parent itself or resource cannot have any parent). // Unlike GetIParentName, it returns actual active parent - and GetResourceDescriptor returns different // descriptor instance. GetIUnderlyingParentName() Name }
Name is an interface for goten name and reference goten types (including parent variants).
type NameDescriptor ¶
type NameDescriptor struct {
// contains filtered or unexported fields
}
func NewNameDescriptor ¶
func NewNameDescriptor(fp object.FieldPath, patternFieldName, idFieldName string, parentIdFieldNames []string, namePatterns []NamePattern) *NameDescriptor
func (*NameDescriptor) GetAllSegmentIdFieldNames ¶
func (d *NameDescriptor) GetAllSegmentIdFieldNames() []string
func (*NameDescriptor) GetFieldPath ¶
func (d *NameDescriptor) GetFieldPath() object.FieldPath
func (*NameDescriptor) GetIdFieldName ¶
func (d *NameDescriptor) GetIdFieldName() string
func (*NameDescriptor) GetNamePatterns ¶
func (d *NameDescriptor) GetNamePatterns() []NamePattern
func (*NameDescriptor) GetParentIdFieldNames ¶
func (d *NameDescriptor) GetParentIdFieldNames() []string
func (*NameDescriptor) GetPatternFieldName ¶
func (d *NameDescriptor) GetPatternFieldName() string
type NamePattern ¶
type NamePattern string
NamePattern represents structure of a resource name
func (NamePattern) IsPrefixOf ¶
func (np NamePattern) IsPrefixOf(other NamePattern) bool
func (NamePattern) SegmentPatterns ¶
func (np NamePattern) SegmentPatterns() NameSegmentPatterns
func (NamePattern) SegmentsCount ¶
func (np NamePattern) SegmentsCount() int
func (NamePattern) String ¶
func (np NamePattern) String() string
type NameSegment ¶
NameSegment represents single segment within resource name. Consists of collection name and identifier.
func (NameSegment) String ¶
func (ns NameSegment) String() string
type NameSegmentPattern ¶
func (NameSegmentPattern) IdFieldName ¶
func (ns NameSegmentPattern) IdFieldName() string
func (NameSegmentPattern) MakeSegment ¶
func (ns NameSegmentPattern) MakeSegment(idValue string) NameSegment
func (NameSegmentPattern) String ¶
func (ns NameSegmentPattern) String() string
type NameSegmentPatterns ¶
type NameSegmentPatterns []NameSegmentPattern
func (NameSegmentPatterns) String ¶
func (nsp NameSegmentPatterns) String() string
type NameSegments ¶
type NameSegments []NameSegment
func (NameSegments) String ¶
func (ns NameSegments) String() string
type OffsetCursorValue ¶
type OffsetCursorValue struct {
Offset int32
}
OffsetCursorValue uses integer offset as a way to indicate point in database for Cursor. Offset must be 0-indexed and point from the beginning for given Filter and OrderBy.
func NewOffsetCursorValue ¶
func NewOffsetCursorValue(offset int32) *OffsetCursorValue
func ParseOffsetCursorValue ¶
func ParseOffsetCursorValue(strValue string) (*OffsetCursorValue, error)
func (*OffsetCursorValue) GetOffset ¶
func (ocp *OffsetCursorValue) GetOffset() int32
func (*OffsetCursorValue) GetValueType ¶
func (ocp *OffsetCursorValue) GetValueType() CursorValueType
func (*OffsetCursorValue) MakeBackwardValue ¶
func (ocp *OffsetCursorValue) MakeBackwardValue(direction PageDirection, advanceBy int32) *OffsetCursorValue
func (*OffsetCursorValue) MakeForwardValue ¶
func (ocp *OffsetCursorValue) MakeForwardValue(direction PageDirection, advanceBy int32) *OffsetCursorValue
func (*OffsetCursorValue) String ¶
func (ocp *OffsetCursorValue) String() string
type OrderBy ¶
type OrderBy interface { fmt.Stringer preflect.ProtoStringer GetRawFieldMask() object.FieldMask GetOrderByFields() []OrderByField SortRaw(ResourceList) InsertSortedRaw(ResourceList, Resource) (ResourceList, int) CompareRaw(Resource, Resource) int }
OrderBy indicates which ordering index should be used when querying for resources.
type OrderByField ¶
type OrderByField interface { GetDirection() OrderDirection GetFieldPath() object.FieldPath }
type OrderDirection ¶
type OrderDirection string
const ( DirectionASC OrderDirection = "asc" DirectionDESC OrderDirection = "desc" )
func OrderDirectionFromString ¶
func OrderDirectionFromString(str string) (result OrderDirection, err error)
func (OrderDirection) Reverse ¶
func (od OrderDirection) Reverse() OrderDirection
type OwnerRefFlag ¶ added in v1.0.0
type OwnerRefFlag func(o *meta.OwnerReference)
func WithController ¶ added in v1.0.0
func WithController() OwnerRefFlag
func WithRequiresOwnerReference ¶ added in v1.0.0
func WithRequiresOwnerReference() OwnerRefFlag
type PageDirection ¶
type PageDirection string
const ( PageLeft PageDirection = "l" PageRight PageDirection = "r" )
func PageDirectionFromString ¶
func PageDirectionFromString(str string) (result PageDirection, err error)
func (PageDirection) IsLeft ¶
func (pd PageDirection) IsLeft() bool
func (PageDirection) IsRight ¶
func (pd PageDirection) IsRight() bool
func (PageDirection) Reverse ¶
func (pd PageDirection) Reverse() PageDirection
type PagerQuery ¶
type PagerQuery interface { GetCursor() Cursor GetOrderBy() OrderBy GetLimit() int GetPeekForward() bool PageDirection() PageDirection SetCursor(Cursor) SetOrderBy(OrderBy) SetLimit(int) SetPeekForward(bool) SetPageDirection(PageDirection) GetResourceDescriptor() Descriptor }
PagerQuery wraps paging parameters of a query.
type ParentNameList ¶
type ParentNameList interface { Append(res Name) ParentNameList AppendList(list ParentNameList) ParentNameList Slice(first, second int) ParentNameList At(idx int) Name Set(idx int, name Name) Length() int }
type ParentReferenceList ¶
type ParentReferenceList interface { Append(ref Reference) ParentReferenceList AppendList(list ParentReferenceList) ParentReferenceList Slice(first, second int) ParentReferenceList At(idx int) Reference Set(idx int, ref Reference) Length() int }
type Query ¶
type Query interface { fmt.Stringer GotenQuery() GetResourceDescriptor() Descriptor }
type QueryOption ¶ added in v1.6.8
type QueryOption func(*queryOptions)
func WithQuerySkipCache ¶ added in v1.6.8
func WithQuerySkipCache() QueryOption
type QueryOptions ¶ added in v1.6.8
type QueryOptions interface {
GetSkipCache() bool
}
func MakeQueryOptions ¶ added in v1.6.8
func MakeQueryOptions(opts []QueryOption) QueryOptions
type QueryResultChange ¶
type QueryResultChange interface { GetResults() ResourceChangeList GetNextPageCursor() Cursor GetPrevPageCursor() Cursor GetIsCurrent() bool GetIsHardReset() bool GetIsSoftReset() bool GetSnapshotSize() int64 GetResumeToken() string SetResults(ResourceChangeList) SetCursors(Cursor, Cursor) SetIsCurrent() SetIsHardReset() SetIsSoftReset() SetSnapshotSize(int64) SetResumeToken(string) }
type QueryResultSnapshot ¶
type QueryResultSnapshot interface { GetResults() ResourceList GetNextPageCursor() Cursor GetPrevPageCursor() Cursor GetPagingInfo() (totalCount, offset int32) SetResults(ResourceList) SetCursors(Cursor, Cursor) SetPagingInfo(totalCount, offset int32) }
type Reference ¶
type Reference interface { Name Resolved() bool ClearCached() GetRawResource() Resource ResolveRaw(Resource) error }
Interface for goten reference or parent reference types
type ReferenceList ¶
type ReferenceList interface { Append(ref Reference) ReferenceList AppendList(list ReferenceList) ReferenceList Slice(first, second int) ReferenceList At(idx int) Reference Set(idx int, ref Reference) Length() int }
type Registry ¶ added in v0.4.16
type Registry struct {
// contains filtered or unexported fields
}
Registry contains all known resource descriptors and allows accessing them by domain name and version. It is responsibility of developer to import all resource packages in order to ensure their registration.
func GetRegistry ¶ added in v0.4.16
func GetRegistry() *Registry
GetRegistry returns global registry instance
func (*Registry) FindResourceDescriptor ¶ added in v0.4.16
func (r *Registry) FindResourceDescriptor(fullyQualifiedName, version string) Descriptor
FindResourceDescriptor gives resource descriptor based on fully qualified name and version
func (*Registry) RegisterDescriptor ¶ added in v0.4.16
func (r *Registry) RegisterDescriptor(descriptor Descriptor)
RegisterDescriptor is called by each imported resource package.
type Resource ¶
type Resource interface { goten.GotenMessage object.GotenObjectExt GetRawName() Name GetResourceDescriptor() Descriptor GetMetadata() *meta.Meta EnsureMetadata() *meta.Meta }
type ResourceChange ¶
type ResourceChange interface { goten.GotenMessage IsAdd() bool IsModify() bool IsDelete() bool IsCurrent() bool GetRawResource() Resource GetRawName() Name SetAddedRaw(Resource, int) SetModifiedRaw(Name, Resource, int, int) SetDeletedRaw(Name, int) SetCurrentRaw(Resource) GetCurrentViewIndex() int32 GetPreviousViewIndex() int32 }
type ResourceChangeList ¶
type ResourceChangeList interface { Append(change ResourceChange) ResourceChangeList AppendList(list ResourceChangeList) ResourceChangeList Slice(first, second int) ResourceChangeList At(idx int) ResourceChange Set(idx int, change ResourceChange) Length() int }
type ResourceChangeMap ¶
type ResourceChangeMap interface { Get(name Name) ResourceChange Set(change ResourceChange) Delete(name Name) Length() int ForEach(cb func(Name, ResourceChange) bool) }
type ResourceList ¶
type ResourceList interface { Append(res Resource) ResourceList AppendList(list ResourceList) ResourceList Slice(first, second int) ResourceList At(idx int) Resource Set(idx int, res Resource) Length() int }
type ResourceMap ¶
type SaveOption ¶
type SaveOption func(*saveOptions)
func WithCompareAndSwap ¶ added in v0.4.16
func WithCompareAndSwap(state Resource, mask object.FieldMask) SaveOption
func WithCreateModeOnly ¶ added in v0.4.16
func WithCreateModeOnly() SaveOption
func WithPreviousResource ¶
func WithPreviousResource(previous Resource) SaveOption
func WithUpdateMask ¶ added in v0.4.16
func WithUpdateMask(mask object.FieldMask) SaveOption
func WithUpdateModeOnly ¶ added in v0.4.16
func WithUpdateModeOnly() SaveOption
type SaveOptions ¶
type SaveOptions interface { OnlyCreate() bool OnlyUpdate() bool GetPreviousResource() Resource GetUpdateMask() object.FieldMask GetCAS() (object.FieldMask, Resource) }
func MakeSaveOptions ¶
func MakeSaveOptions(opts []SaveOption) SaveOptions
type SearchQuery ¶
type SnapshotCursorValue ¶
type SnapshotCursorValue struct {
Snapshot Resource
}
SnapshotCursorValue uses resource as a point in the database index
func NewSnapshotCursorValue ¶
func NewSnapshotCursorValue(snapshot Resource) *SnapshotCursorValue
func ParseSnapshotCursorValue ¶
func ParseSnapshotCursorValue(descriptor Descriptor, strValue string) (*SnapshotCursorValue, error)
func (*SnapshotCursorValue) GetSnapshot ¶
func (scp *SnapshotCursorValue) GetSnapshot() Resource
func (*SnapshotCursorValue) GetValueType ¶
func (scp *SnapshotCursorValue) GetValueType() CursorValueType
func (*SnapshotCursorValue) String ¶
func (scp *SnapshotCursorValue) String() string
type TypeName ¶
type TypeName struct {
// contains filtered or unexported fields
}
func NewTypeName ¶
func (*TypeName) FullyQualifiedTypeName ¶
func (*TypeName) JSONPlural ¶
func (*TypeName) JSONSingular ¶
func (*TypeName) ServiceDomain ¶ added in v0.4.16
type UnknownConditionContainsType ¶
type UnknownConditionContainsType struct {
Type ConditionContainsType
}
func (*UnknownConditionContainsType) Error ¶
func (ucct *UnknownConditionContainsType) Error() string
type WatchQuery ¶
type WatchQuery interface { ListQuery GetWatchType() watch_type.WatchType GetMaximumChunkSize() int GetResumeToken() string GetStartingTime() *timestamppb.Timestamp SetWatchType(watch_type.WatchType) SetMaximumChunkSize(int) SetResumeToken(string) SetStartingTime(*timestamppb.Timestamp) }