Documentation ¶
Index ¶
- Constants
- type CassandraConnector
- func (c CassandraConnector) Delete(table, id string, opts CassandraQueryOptions) error
- func (c CassandraConnector) FilteredReadAll(table string, opts CassandraQueryOptions, readType ReadAllInterface) ([]interface{}, error)
- func (c CassandraConnector) Read(table, id string, opts CassandraQueryOptions, object interface{}) error
- func (c CassandraConnector) ReadAll(table string, readType ReadAllInterface) ([]interface{}, error)
- func (c CassandraConnector) Save(table, key string, object interface{}) error
- type CassandraQueryOptions
- type DataAccess
- type FileSystem
- type Filter
- type LocalFileSystem
- type MockDataAccessor
- func (c MockDataAccessor) Delete(table, id string, opts CassandraQueryOptions) error
- func (d MockDataAccessor) FilteredReadAll(t string, opts CassandraQueryOptions, r ReadAllInterface) ([]interface{}, error)
- func (m MockDataAccessor) Read(t, s string, opts CassandraQueryOptions, i interface{}) error
- func (m MockDataAccessor) ReadAll(t string, r ReadAllInterface) ([]interface{}, error)
- func (m MockDataAccessor) Save(t, s string, i interface{}) error
- type MockErrorDataAccessor
- func (c MockErrorDataAccessor) Delete(table, id string, opts CassandraQueryOptions) error
- func (d MockErrorDataAccessor) FilteredReadAll(t string, opts CassandraQueryOptions, r ReadAllInterface) ([]interface{}, error)
- func (e MockErrorDataAccessor) Read(t, s string, opts CassandraQueryOptions, i interface{}) error
- func (e MockErrorDataAccessor) ReadAll(t string, r ReadAllInterface) ([]interface{}, error)
- func (e MockErrorDataAccessor) Save(t, s string, i interface{}) error
- type MockErrorFileSystem
- type MockFileSystem
- type ReadAllInterface
- type S3Session
Constants ¶
const TimestampFormat = "2006-01-02 15:04:05-0700"
TimestampFormat is a CSQL-compatible timestamp format
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CassandraConnector ¶
type CassandraConnector struct { *gocql.Session *logrus.Logger // contains filtered or unexported fields }
func NewCassandraConnector ¶
func NewCassandraConnector(path, port, keyspace, username, password string) *CassandraConnector
func (CassandraConnector) Delete ¶
func (c CassandraConnector) Delete(table, id string, opts CassandraQueryOptions) error
func (CassandraConnector) FilteredReadAll ¶
func (c CassandraConnector) FilteredReadAll(table string, opts CassandraQueryOptions, readType ReadAllInterface) ([]interface{}, error)
func (CassandraConnector) Read ¶
func (c CassandraConnector) Read(table, id string, opts CassandraQueryOptions, object interface{}) error
func (CassandraConnector) ReadAll ¶
func (c CassandraConnector) ReadAll(table string, readType ReadAllInterface) ([]interface{}, error)
func (CassandraConnector) Save ¶
func (c CassandraConnector) Save(table, key string, object interface{}) error
type CassandraQueryOptions ¶
type CassandraQueryOptions struct {
Filters []Filter
}
func NewCassandraQueryOptions ¶
func NewCassandraQueryOptions(key, value string, id bool) CassandraQueryOptions
NewCassandraQueryOptions creates a new options object. key: query field name value: query value id: True if field is a UUID Cassandra key
func (*CassandraQueryOptions) AddFilter ¶
func (o *CassandraQueryOptions) AddFilter(key, value string, id bool)
AddFilter adds a filter to an CassandraQueryOptions object key: query field name value: query value id: True if field is a UUID Cassandra key
type DataAccess ¶
type DataAccess interface { Save(table, key string, object interface{}) error Read(table, key string, opts CassandraQueryOptions, object interface{}) error ReadAll(table string, readType ReadAllInterface) ([]interface{}, error) FilteredReadAll(table string, opts CassandraQueryOptions, readType ReadAllInterface) ([]interface{}, error) Delete(table, id string, opts CassandraQueryOptions) error }
DataAccess represents an interface for accessing and managing a data storage system (e.g. a database). Implementations of DataAccess should ensure that the objects passed to them are properly serialized under, and can be retrieved by providing, the specified key string.
type FileSystem ¶
type FileSystem interface { Read(path string) (resource io.Reader, err error) Write(path string, resource io.ReadSeeker) (url string, err error) Delete(path string) (err error) }
FileSystem represents a file system that contains resources identifable by a path string. These resources can be Read, Written, or Deleted.
type LocalFileSystem ¶
type LocalFileSystem struct {
// contains filtered or unexported fields
}
LocalFileSystem represents the project's directory on the local machine's file system. Implements the data.FileSystem interface.
func NewLocalFileSystem ¶
func NewLocalFileSystem() *LocalFileSystem
NewLocalFileSystem returns a new LocalFileSystem object initialized to operate within the project's directory in the local file system
func (*LocalFileSystem) Delete ¶
func (lfs *LocalFileSystem) Delete(path string) (err error)
Delete removes the resource located at the specified path from the project's directory in the local file system.
func (*LocalFileSystem) Read ¶
func (lfs *LocalFileSystem) Read(path string) (resource io.Reader, err error)
Read returns an io.Reader tht reads from the resource at the specified path within the project's directory in the local file system.
func (*LocalFileSystem) Write ¶
func (lfs *LocalFileSystem) Write(path string, resource io.ReadSeeker) (url string, err error)
Write saves the specified resource to the project's directory on the local file system under the specified path.
type MockDataAccessor ¶
type MockDataAccessor struct{}
func (MockDataAccessor) Delete ¶
func (c MockDataAccessor) Delete(table, id string, opts CassandraQueryOptions) error
func (MockDataAccessor) FilteredReadAll ¶
func (d MockDataAccessor) FilteredReadAll(t string, opts CassandraQueryOptions, r ReadAllInterface) ([]interface{}, error)
func (MockDataAccessor) Read ¶
func (m MockDataAccessor) Read(t, s string, opts CassandraQueryOptions, i interface{}) error
func (MockDataAccessor) ReadAll ¶
func (m MockDataAccessor) ReadAll(t string, r ReadAllInterface) ([]interface{}, error)
func (MockDataAccessor) Save ¶
func (m MockDataAccessor) Save(t, s string, i interface{}) error
type MockErrorDataAccessor ¶
type MockErrorDataAccessor struct{}
func (MockErrorDataAccessor) Delete ¶
func (c MockErrorDataAccessor) Delete(table, id string, opts CassandraQueryOptions) error
func (MockErrorDataAccessor) FilteredReadAll ¶
func (d MockErrorDataAccessor) FilteredReadAll(t string, opts CassandraQueryOptions, r ReadAllInterface) ([]interface{}, error)
func (MockErrorDataAccessor) Read ¶
func (e MockErrorDataAccessor) Read(t, s string, opts CassandraQueryOptions, i interface{}) error
func (MockErrorDataAccessor) ReadAll ¶
func (e MockErrorDataAccessor) ReadAll(t string, r ReadAllInterface) ([]interface{}, error)
func (MockErrorDataAccessor) Save ¶
func (e MockErrorDataAccessor) Save(t, s string, i interface{}) error
type MockErrorFileSystem ¶
type MockErrorFileSystem struct{}
func (MockErrorFileSystem) Delete ¶
func (m MockErrorFileSystem) Delete(path string) (err error)
func (MockErrorFileSystem) Read ¶
func (m MockErrorFileSystem) Read(path string) (resource io.Reader, err error)
func (MockErrorFileSystem) Write ¶
func (m MockErrorFileSystem) Write(path string, resource io.ReadSeeker) (url string, err error)
type MockFileSystem ¶
type MockFileSystem struct{}
func (MockFileSystem) Delete ¶
func (m MockFileSystem) Delete(path string) (err error)
func (MockFileSystem) Read ¶
func (m MockFileSystem) Read(path string) (resource io.Reader, err error)
func (MockFileSystem) Write ¶
func (m MockFileSystem) Write(path string, resource io.ReadSeeker) (url string, err error)
type ReadAllInterface ¶
type ReadAllInterface interface {
GetType() interface{}
}
ReadAllInterface implementations must contain a GetType() function that returns the type of the implementor.
type S3Session ¶
type S3Session struct {
// contains filtered or unexported fields
}
S3Session represents a connection to the project's AWS S3 bucket. Implements data.FileSystem interface.
func NewS3Session ¶
NewS3Session returns a new S3Session object connected to the project's S3 bucket. If connection fails, then returns non-nil error.
func (*S3Session) Delete ¶
Delete removes the resource located at the specified path from the project's S3 bucket.