sqlite

package
v0.0.0-...-ab4b146 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRootService

type APIRootService struct {
	DB        *sql.DB
	DataStore *DataStore
}

APIRootService implements a SQLite version of the APIRootService interface

func (APIRootService) APIRoot

func (s APIRootService) APIRoot(ctx context.Context, path string) (cabby.APIRoot, error)

APIRoot will read from the data store and return the resource

func (APIRootService) APIRoots

func (s APIRootService) APIRoots(ctx context.Context) ([]cabby.APIRoot, error)

APIRoots will read from the data store and return the resource

func (APIRootService) CreateAPIRoot

func (s APIRootService) CreateAPIRoot(ctx context.Context, a cabby.APIRoot) error

CreateAPIRoot creates a user in the data store

func (APIRootService) DeleteAPIRoot

func (s APIRootService) DeleteAPIRoot(ctx context.Context, id string) error

DeleteAPIRoot creates a user in the data store

func (APIRootService) UpdateAPIRoot

func (s APIRootService) UpdateAPIRoot(ctx context.Context, a cabby.APIRoot) error

UpdateAPIRoot creates a user in the data store

type CollectionService

type CollectionService struct {
	DB        *sql.DB
	DataStore *DataStore
}

CollectionService implements a SQLite version of the CollectionService interface

func (CollectionService) Collection

func (s CollectionService) Collection(ctx context.Context, apiRootPath, collectionID string) (cabby.Collection, error)

Collection will read from the data store and return the resource

func (CollectionService) Collections

func (s CollectionService) Collections(ctx context.Context, apiRootPath string, cr *cabby.Range) (cabby.Collections, error)

Collections will read from the data store and return the resource

func (CollectionService) CollectionsInAPIRoot

func (s CollectionService) CollectionsInAPIRoot(ctx context.Context, apiRootPath string) (cabby.CollectionsInAPIRoot, error)

CollectionsInAPIRoot return collections in a given api root

func (CollectionService) CreateCollection

func (s CollectionService) CreateCollection(ctx context.Context, c cabby.Collection) error

CreateCollection creates a user in the data store

func (CollectionService) DeleteCollection

func (s CollectionService) DeleteCollection(ctx context.Context, id string) error

DeleteCollection creates a user in the data store

func (CollectionService) UpdateCollection

func (s CollectionService) UpdateCollection(ctx context.Context, c cabby.Collection) error

UpdateCollection creates a user in the data store

type DataStore

type DataStore struct {
	DB   *sql.DB
	Path string
}

DataStore represents a SQLite database

func NewDataStore

func NewDataStore(path string) (*DataStore, error)

NewDataStore returns a sqliteDB

func (*DataStore) APIRootService

func (s *DataStore) APIRootService() cabby.APIRootService

APIRootService returns a service for api root resources

func (*DataStore) Close

func (s *DataStore) Close()

Close connection to datastore

func (*DataStore) CollectionService

func (s *DataStore) CollectionService() cabby.CollectionService

CollectionService returns a service for collection resources

func (*DataStore) DiscoveryService

func (s *DataStore) DiscoveryService() cabby.DiscoveryService

DiscoveryService returns a service for discovery resources

func (*DataStore) ManifestService

func (s *DataStore) ManifestService() cabby.ManifestService

ManifestService returns a service for object resources

func (*DataStore) ObjectService

func (s *DataStore) ObjectService() cabby.ObjectService

ObjectService returns a service for object resources

func (*DataStore) Open

func (s *DataStore) Open() (err error)

Open connection to datastore

func (*DataStore) StatusService

func (s *DataStore) StatusService() cabby.StatusService

StatusService returns service for status resources

func (*DataStore) UserService

func (s *DataStore) UserService() cabby.UserService

UserService returns a service for user resources

type DiscoveryService

type DiscoveryService struct {
	DB        *sql.DB
	DataStore *DataStore
}

DiscoveryService implements a SQLite version of the DiscoveryService interface

func (DiscoveryService) CreateDiscovery

func (s DiscoveryService) CreateDiscovery(ctx context.Context, d cabby.Discovery) error

CreateDiscovery creates a user in the data store

func (DiscoveryService) DeleteDiscovery

func (s DiscoveryService) DeleteDiscovery(ctx context.Context) error

DeleteDiscovery creates a user in the data store

func (DiscoveryService) Discovery

func (s DiscoveryService) Discovery(ctx context.Context) (cabby.Discovery, error)

Discovery will read from the data store and return the resource

func (DiscoveryService) UpdateDiscovery

func (s DiscoveryService) UpdateDiscovery(ctx context.Context, d cabby.Discovery) error

UpdateDiscovery creates a user in the data store

type Filter

type Filter struct {
	cabby.Filter
}

Filter implementation for SQLite

func (*Filter) QueryString

func (f *Filter) QueryString() (q string, args []interface{})

QueryString will convert a filter into a query string for a service query

type ManifestService

type ManifestService struct {
	DB *sql.DB
}

ManifestService implements a SQLite version of the ManifestService interface

func (ManifestService) Manifest

func (s ManifestService) Manifest(ctx context.Context, collectionID string, cr *cabby.Range, f cabby.Filter) (cabby.Manifest, error)

Manifest will read from the data store and return the resource

type ObjectService

type ObjectService struct {
	DB        *sql.DB
	DataStore *DataStore
}

ObjectService implements a SQLite version of the ObjectService interface

func (ObjectService) CreateBundle

func (s ObjectService) CreateBundle(ctx context.Context, b stones.Bundle, collectionID string, st cabby.Status, ss cabby.StatusService)

CreateBundle will read from the data store and return the resource

func (ObjectService) CreateObject

func (s ObjectService) CreateObject(ctx context.Context, object cabby.Object) error

CreateObject will read from the data store and return the resource

func (ObjectService) Object

func (s ObjectService) Object(ctx context.Context, collectionID, objectID string, f cabby.Filter) ([]cabby.Object, error)

Object will read from the data store and return the resource

func (ObjectService) Objects

func (s ObjectService) Objects(ctx context.Context, collectionID string, cr *cabby.Range, f cabby.Filter) ([]cabby.Object, error)

Objects will read from the data store and return the resource

type Range

type Range struct {
	*cabby.Range
}

Range implementation for SQLite

func (*Range) QueryString

func (r *Range) QueryString() (q string, args []interface{})

QueryString returns sql for paginating a range of data

type StatusService

type StatusService struct {
	DB        *sql.DB
	DataStore *DataStore
}

StatusService implements a SQLite version of the StatusService interface

func (StatusService) CreateStatus

func (s StatusService) CreateStatus(ctx context.Context, status cabby.Status) error

CreateStatus will read from the data store and return the resource

func (StatusService) Status

func (s StatusService) Status(ctx context.Context, statusID string) (cabby.Status, error)

Status will read from the data store and return the resource

func (StatusService) UpdateStatus

func (s StatusService) UpdateStatus(ctx context.Context, status cabby.Status) error

UpdateStatus will read from the data store and return the resource

type UserService

type UserService struct {
	DB        *sql.DB
	DataStore *DataStore
}

UserService implements a SQLite version of the servce

func (UserService) CreateUser

func (s UserService) CreateUser(ctx context.Context, user cabby.User, password string) error

CreateUser creates a user in the data store

func (UserService) CreateUserCollection

func (s UserService) CreateUserCollection(ctx context.Context, user string, ca cabby.CollectionAccess) error

CreateUserCollection creates an association of a user to a collection

func (UserService) DeleteUser

func (s UserService) DeleteUser(ctx context.Context, user string) error

DeleteUser creates a user in the data store

func (UserService) DeleteUserCollection

func (s UserService) DeleteUserCollection(ctx context.Context, user, id string) error

DeleteUserCollection deletes a collection from a user

func (UserService) UpdateUser

func (s UserService) UpdateUser(ctx context.Context, user cabby.User) error

UpdateUser creates a user in the data store

func (UserService) UpdateUserCollection

func (s UserService) UpdateUserCollection(ctx context.Context, user string, ca cabby.CollectionAccess) error

UpdateUserCollection update a users access to a specfific collection

func (UserService) User

func (s UserService) User(ctx context.Context, user, password string) (cabby.User, error)

User will read from the data store and populate the result with a resource

func (UserService) UserCollections

func (s UserService) UserCollections(ctx context.Context, user string) (cabby.UserCollectionList, error)

UserCollections will read from the data store and populate the result with a resource

Jump to

Keyboard shortcuts

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