Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(config config.MongodbConfig) (*connection, error)
Types ¶
type CheckinObj ¶
type MongoStorage ¶
type MongoStorage struct {
// contains filtered or unexported fields
}
func (*MongoStorage) UpdateById ¶
func (ms *MongoStorage) UpdateById(id string, update KV, operation OperationMap) error
type Object ¶
type Object struct { ID interface{} `bson:"_id" json:"id"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` CompletedAt time.Time `bson:"completedAt" json:"completedAt"` Error string `bson:"error" json:"error"` CurrentStep string `bson:"currentStep" json:"currentStep"` CommandGraph string `bson:"commandGraph" json:"commandGraph"` Status Status `bson:"status" json:"status"` Params map[string]interface{} `bson:"params" json:"params"` }
Update operations must reference this fields by their json tag
type OperationMap ¶
type OperationMap map[OperationKey]OperationValue
type OperationValue ¶
type OperationValue map[string]interface{}
type Repository ¶
type Repository struct {
Storage
}
Repository provides utilitarian wrappings around Storage for internal usage
func NewMongoStorage ¶
func NewMongoStorage(config config.MongodbConfig) (*Repository, error)
func NewRepository ¶
func NewRepository(storage Storage) *Repository
func (*Repository) CheckinJob ¶
func (r *Repository) CheckinJob(id string, step string) error
func (*Repository) CompleteJob ¶
func (r *Repository) CompleteJob(id string) error
type Storage ¶
type Storage interface { Create(obj ObjectDTO) (*Object, error) FindById(id string) (*Object, error) UpdateById(id string, update KV, operation OperationMap) error }
Storage provides easy to provide minimalistic approach to abstract persistent storage. Update operation receives map of fields which corresponds to object's json field tags by name.
Click to show internal directories.
Click to hide internal directories.