persist

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2016 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityActions added in v1.0.0

type EntityActions struct {
	Engines *PersistEngineBag
}

FilePersister persists body in file

func (EntityActions) ApplyActions added in v1.0.0

func (ea EntityActions) ApplyActions(m *definition.Mock)

type EntityPersister added in v1.0.0

type EntityPersister interface {
	Read(name string) (string, error)
	ReadCollection(name string) (string, error)
	Write(name, content string) error
	Delete(name string) error
	DeleteCollection(name string) error
	GetName() string
	GetSequence(name string, increase int) (int, error)
	GetValue(key string) (string, error)
	SetValue(key string, value string) error
}

type FilePersister added in v1.0.0

type FilePersister struct {
	PersistPath string
}

FilePersister persists body in file

func NewFilePersister added in v1.0.0

func NewFilePersister(persistPath string) *FilePersister

NewFilePersister creates a new FilePersister

func (FilePersister) Delete added in v1.0.0

func (fp FilePersister) Delete(name string) error

func (FilePersister) DeleteCollection added in v1.0.0

func (fp FilePersister) DeleteCollection(name string) error

func (FilePersister) GetName added in v1.0.0

func (fp FilePersister) GetName() string

func (FilePersister) GetSequence added in v1.0.0

func (fp FilePersister) GetSequence(name string, increase int) (int, error)

func (FilePersister) GetValue added in v1.0.0

func (fp FilePersister) GetValue(key string) (string, error)

func (FilePersister) Read added in v1.0.0

func (fp FilePersister) Read(name string) (string, error)

func (FilePersister) ReadCollection added in v1.0.0

func (fp FilePersister) ReadCollection(name string) (string, error)

func (FilePersister) SetValue added in v1.0.0

func (fp FilePersister) SetValue(key string, value string) error

func (FilePersister) Write added in v1.0.0

func (fp FilePersister) Write(name, content string) error

type MongoPersister added in v1.0.0

type MongoPersister struct {
	Repository MongoRepository
}

MongoPersister persists body in mongo

func NewMongoPersister added in v1.0.0

func NewMongoPersister(connectionString string) *MongoPersister

NewMongoPersister creates a new MongoPersister

func (MongoPersister) Delete added in v1.0.0

func (mp MongoPersister) Delete(name string) error

func (MongoPersister) DeleteCollection added in v1.0.0

func (mp MongoPersister) DeleteCollection(name string) error

func (MongoPersister) GetName added in v1.0.0

func (mp MongoPersister) GetName() string

func (MongoPersister) GetSequence added in v1.0.0

func (mp MongoPersister) GetSequence(name string, increase int) (int, error)

func (MongoPersister) GetValue added in v1.0.0

func (mp MongoPersister) GetValue(key string) (string, error)

func (MongoPersister) Read added in v1.0.0

func (mp MongoPersister) Read(name string) (string, error)

func (MongoPersister) ReadCollection added in v1.0.0

func (mp MongoPersister) ReadCollection(name string) (string, error)

func (MongoPersister) SetValue added in v1.0.0

func (mp MongoPersister) SetValue(key string, value string) error

func (MongoPersister) Write added in v1.0.0

func (mp MongoPersister) Write(name, content string) error

type MongoRepository added in v1.0.0

type MongoRepository struct {
	ConnectionInfo mgo.DialInfo
}

MongoRepository saves and loads items from mongo

func NewMongoRepository added in v1.0.0

func NewMongoRepository(connectionString string) *MongoRepository

NewMongoRepository creates a new MongoRepository

func (MongoRepository) ConnectMongo added in v1.0.0

func (mr MongoRepository) ConnectMongo() (session *mgo.Session, err error)

func (MongoRepository) DeleteItem added in v1.0.0

func (mr MongoRepository) DeleteItem(collectionName string, id string) error

DeleteItem deletes an item from a collection

func (MongoRepository) GetAllItems added in v1.0.0

func (mr MongoRepository) GetAllItems(collectionName string) (map[string]string, error)

GetAllItems gets all the items from a given collection

func (MongoRepository) GetItem added in v1.0.0

func (mr MongoRepository) GetItem(collectionName string, id string) (value string, err error)

GetItem gets the result string rom interface

func (MongoRepository) UpsertItem added in v1.0.0

func (mr MongoRepository) UpsertItem(collectionName string, id string, body string) error

UpsertItem inserts or updates item with a given id in a given collection

type PersistEngineBag added in v1.0.0

type PersistEngineBag struct {
	// contains filtered or unexported fields
}

func GetNewPersistEngineBag added in v1.0.0

func GetNewPersistEngineBag(def EntityPersister) *PersistEngineBag

func (*PersistEngineBag) Add added in v1.0.0

func (peb *PersistEngineBag) Add(engine EntityPersister)

func (*PersistEngineBag) Get added in v1.0.0

func (peb *PersistEngineBag) Get(name string) EntityPersister

func (*PersistEngineBag) SetDefault added in v1.0.0

func (peb *PersistEngineBag) SetDefault(def EntityPersister)

Jump to

Keyboard shortcuts

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