blobstore

package module
v0.0.0-...-e94c945 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: Apache-2.0 Imports: 19 Imported by: 2

README

blobstore

Generic blob store to be used by HP go services

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFileToObject

func LoadFileToObject(path string, object interface{}) error

Load file to struct

func WriteObjectToFile

func WriteObjectToFile(path string, object interface{}) error

Store struct to file

Types

type BlobStore

type BlobStore interface {
	Store(key string, object interface{}) error
	// Ugly way to abstract the return type, as in Go you can't cast []interface{} to a
	// specific type. Users will have to assume the interface{} is a array type of
	// objects created by the factory func.
	// Factory is the function to create a per typed interface object
	LoadAll(factory func() interface{}) (interface{}, error)
	Load(key string, object interface{}) error
	Delete(key string) error
}

func NewBlobStore

func NewBlobStore(name string, config BlobStoreConfig) (BlobStore, error)

type BlobStoreConfig

type BlobStoreConfig interface {
	GetString(name string) string
}

type DatastoreDB

type DatastoreDB struct {
	Name       string
	DomainName string
	ProjectId  string
	Config     BlobStoreConfig
	// contains filtered or unexported fields
}

func NewDatastoreDB

func NewDatastoreDB(name string, config BlobStoreConfig) (*DatastoreDB, error)

func (*DatastoreDB) Delete

func (db *DatastoreDB) Delete(key string) error

func (*DatastoreDB) Load

func (db *DatastoreDB) Load(key string, object interface{}) error

func (*DatastoreDB) LoadAll

func (db *DatastoreDB) LoadAll(f func() interface{}) (interface{}, error)

func (*DatastoreDB) Store

func (db *DatastoreDB) Store(key string, object interface{}) error

type FileStore

type FileStore struct {
	Name string
	Path string
	// contains filtered or unexported fields
}

File store saves each key value as a seperate file in the folder that's specified in the Path This is meant to be used only for local testing and usage.

func NewFile

func NewFile(name string, config BlobStoreConfig) (*FileStore, error)

func (*FileStore) Delete

func (file *FileStore) Delete(key string) error

func (*FileStore) Load

func (file *FileStore) Load(key string, object interface{}) error

func (*FileStore) LoadAll

func (file *FileStore) LoadAll(f func() interface{}) (interface{}, error)

func (*FileStore) Store

func (file *FileStore) Store(key string, object interface{}) error

type SimpleDB

type SimpleDB struct {
	Name string

	Region string
	Config BlobStoreConfig
	// contains filtered or unexported fields
}

func NewSimpleDB

func NewSimpleDB(name string, config BlobStoreConfig) (*SimpleDB, error)

func (*SimpleDB) Delete

func (db *SimpleDB) Delete(key string) error

func (*SimpleDB) Load

func (db *SimpleDB) Load(key string, object interface{}) error

func (*SimpleDB) LoadAll

func (db *SimpleDB) LoadAll(f func() interface{}) (interface{}, error)

func (*SimpleDB) Store

func (db *SimpleDB) Store(key string, object interface{}) error

Jump to

Keyboard shortcuts

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