get.porter.sh/porter@v1.3.0/pkg/storage/store.go (about) 1 package storage 2 3 import ( 4 "context" 5 ) 6 7 // Store is an interface for managing Porter documents. 8 type Store interface { 9 // Close the connection to the storage backend. 10 Close() error 11 12 // Aggregate executes a pipeline and returns the results. 13 Aggregate(ctx context.Context, collection string, opts AggregateOptions, out interface{}) error 14 15 // Count the number of results that match an optional query. 16 // When the query is omitted, the entire collection is counted. 17 Count(ctx context.Context, collection string, opts CountOptions) (int64, error) 18 19 // EnsureIndex makes sure that the specified index exists as specified. 20 // If it does exist with a different definition, the index is recreated. 21 EnsureIndex(ctx context.Context, opts EnsureIndexOptions) error 22 23 // Find queries a collection, optionally projecting a subset of fields, into 24 // the specified out value. 25 Find(ctx context.Context, collection string, opts FindOptions, out interface{}) error 26 27 // FindOne queries a collection, optionally projecting a subset of fields, 28 // returning the first result onto the specified out value. 29 // Returns ErrNotFound when the query yields no results. 30 FindOne(ctx context.Context, collection string, opts FindOptions, out interface{}) error 31 32 // Get the document specified by its ID into the specified out value. 33 // This is a convenience wrapper around FindOne for situations where you 34 // are retrieving a well-known single document. 35 Get(ctx context.Context, collection string, opts GetOptions, out interface{}) error 36 37 // Insert a set of documents into a collection. 38 Insert(ctx context.Context, collection string, opts InsertOptions) error 39 40 // Patch applies a transformation to matching documents. 41 Patch(ctx context.Context, collection string, opts PatchOptions) error 42 43 // Remove matching documents from a collection. 44 Remove(ctx context.Context, collection string, opts RemoveOptions) error 45 46 // Update matching documents with the specified replacement document. 47 Update(ctx context.Context, collection string, opts UpdateOptions) error 48 }