db

package
v0.0.0-...-986c4a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	// Insert the given resource into the database, or return any error.
	Insert(ctx context.Context, resource *prop.Resource) error
	// Count the number of resources that meets the given SCIM filter.
	Count(ctx context.Context, filter string) (int, error)
	// Get a resource by its id. The projection parameter specifies the attributes to be included or excluded from the
	// response. Implementations may elect to ignore this parameter in case caller services need all the attributes for
	// additional processing.
	Get(ctx context.Context, id string, projection *crud.Projection) (*prop.Resource, error)
	// Overwrite the existing resource with same ID with the new resource
	Replace(ctx context.Context, resource *prop.Resource) error
	// Delete a resource
	Delete(ctx context.Context, resource *prop.Resource) error
	// Query resources. The projection parameter specifies the attributes to be included or excluded from the
	// response. Implementations may elect to ignore this parameter in case caller services need all the attributes for
	// additional processing.
	Query(ctx context.Context, filter string, sort *crud.Sort, pagination *crud.Pagination, projection *crud.Projection) ([]*prop.Resource, error)
}

Abstraction for the database that provides the main persistence and look up capabilities.

func Memory

func Memory() DB

Return a new memory implementation of Database. This implementation saves resources in memory. Although it does allow for concurrent access through the use of RWMutex, it does not allow for high throughput usage. It is intended for testing and showcasing purposes only. This implementation also ignores all the field projection parameters that it always returned the full resource regardless of the request to include or exclude attributes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL