Documentation ¶
Index ¶
- Constants
- Variables
- type CreateOpts
- type CreateOptsFunc
- type DeleteOpts
- type DeleteOptsFunc
- type ErrConstraint
- type ErrUnsupportedListOpts
- type ListOpts
- type ListOptsFunc
- type ObjectStore
- func (s *ObjectStore) Create(ctx context.Context, object model.Object, _ ...CreateOptsFunc) error
- func (s *ObjectStore) Delete(ctx context.Context, opts ...DeleteOptsFunc) error
- func (s *ObjectStore) ForCluster(cluster string) *ObjectStore
- func (s *ObjectStore) List(ctx context.Context, list model.ObjectList, opts ...ListOptsFunc) error
- func (s *ObjectStore) Read(ctx context.Context, object model.Object, opts ...ReadOptsFunc) error
- func (s *ObjectStore) Upsert(ctx context.Context, object model.Object, _ ...CreateOptsFunc) error
- type ReadOpts
- type ReadOptsFunc
- type Store
Constants ¶
View Source
const ( DefaultPage = 1 DefaultPageSize = 100 MaxPageSize = 1000 )
View Source
const DefaultOperationTimeout = 15 * time.Second
Variables ¶
View Source
var (
ErrNotFound = fmt.Errorf("not found")
)
Functions ¶
This section is empty.
Types ¶
type CreateOpts ¶
type CreateOpts struct{}
type CreateOptsFunc ¶
type CreateOptsFunc func(*CreateOpts)
type DeleteOpts ¶
type DeleteOpts struct {
// contains filtered or unexported fields
}
func NewDeleteOpts ¶
func NewDeleteOpts(fns ...DeleteOptsFunc) *DeleteOpts
type DeleteOptsFunc ¶
type DeleteOptsFunc func(*DeleteOpts)
func DeleteByID ¶
func DeleteByID(id string) DeleteOptsFunc
func DeleteByType ¶
func DeleteByType(typ model.Type) DeleteOptsFunc
type ErrConstraint ¶
func (ErrConstraint) Error ¶
func (e ErrConstraint) Error() string
type ErrUnsupportedListOpts ¶
type ErrUnsupportedListOpts struct {
// contains filtered or unexported fields
}
ErrUnsupportedListOpts is used when the provided combination of list options is not supported.
func (ErrUnsupportedListOpts) Error ¶
func (e ErrUnsupportedListOpts) Error() string
type ListOpts ¶
type ListOpts struct { ReferenceType model.Type ReferenceID string PageSize int Page int // CEL expression used for filtering. // Read more: https://github.com/google/cel-spec Filter *exprpb.Expr }
func NewListOpts ¶
func NewListOpts(fns ...ListOptsFunc) (*ListOpts, error)
NewListOpts executes the provided list option functions, validates that all set options are compatible with each other, and returns the generated ListOpts.
type ListOptsFunc ¶
type ListOptsFunc func(*ListOpts)
func ListWithFilter ¶
func ListWithFilter(expr *exprpb.Expr) ListOptsFunc
ListWithFilter associates the passed in CEL expression with the current list pagination options.
func ListWithPageNum ¶
func ListWithPageNum(page int) ListOptsFunc
func ListWithPageSize ¶
func ListWithPageSize(pageSize int) ListOptsFunc
type ObjectStore ¶
type ObjectStore struct {
// contains filtered or unexported fields
}
ObjectStore stores objects. TODO(hbagdi): better name needed between this and the interface.
func New ¶
func New(persister persistence.Persister, logger *zap.Logger) *ObjectStore
func (*ObjectStore) Create ¶
func (s *ObjectStore) Create(ctx context.Context, object model.Object, _ ...CreateOptsFunc, ) error
func (*ObjectStore) Delete ¶
func (s *ObjectStore) Delete(ctx context.Context, opts ...DeleteOptsFunc, ) error
func (*ObjectStore) ForCluster ¶
func (s *ObjectStore) ForCluster(cluster string) *ObjectStore
func (*ObjectStore) List ¶
func (s *ObjectStore) List(ctx context.Context, list model.ObjectList, opts ...ListOptsFunc) error
func (*ObjectStore) Read ¶
func (s *ObjectStore) Read(ctx context.Context, object model.Object, opts ...ReadOptsFunc, ) error
func (*ObjectStore) Upsert ¶
func (s *ObjectStore) Upsert(ctx context.Context, object model.Object, _ ...CreateOptsFunc, ) error
type ReadOpts ¶
type ReadOpts struct {
// contains filtered or unexported fields
}
func NewReadOpts ¶
func NewReadOpts(fns ...ReadOptsFunc) *ReadOpts
type ReadOptsFunc ¶
type ReadOptsFunc func(*ReadOpts)
func GetByID ¶
func GetByID(id string) ReadOptsFunc
func GetByIndex ¶
func GetByIndex(indexName, indexValue string) ReadOptsFunc
func GetByName ¶
func GetByName(name string) ReadOptsFunc
type Store ¶
type Store interface { Create(context.Context, model.Object, ...CreateOptsFunc) error Upsert(context.Context, model.Object, ...CreateOptsFunc) error Read(context.Context, model.Object, ...ReadOptsFunc) error Delete(context.Context, ...DeleteOptsFunc) error List(context.Context, model.ObjectList, ...ListOptsFunc) error }
Click to show internal directories.
Click to hide internal directories.