Documentation ¶
Index ¶
- type Postgres
- func (p *Postgres) CreateProject(projectName string, data []byte) error
- func (p *Postgres) CreateProjectKey(projectName string, data []byte, keys ...string) error
- func (p *Postgres) DeleteProject(projectName string) error
- func (p *Postgres) DeleteProjectKey(projectName string, keys ...string) error
- func (p *Postgres) GetProjectKey(projectName string, keys ...string) ([]byte, error)
- func (p *Postgres) TranslateError(err error) *TranslatedError
- func (p *Postgres) UpdateProjectKey(projectName string, data []byte, keys ...string) error
- type TranslatedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres wraps the db connection to a postgres instance
func NewPostgres ¶
NewPostgres returns a new instance of `Postgres` with a connection to the postgres db based on provided parameters.
func (*Postgres) CreateProject ¶
CreateProject creates a new project with a JSON tree
func (*Postgres) CreateProjectKey ¶
CreateProjectKey saves the data at the provided key path. Fails if the key already exists.
func (*Postgres) DeleteProject ¶
DeleteProject permanently deletes an entire project's tree
func (*Postgres) DeleteProjectKey ¶
DeleteProjectKey permanently removes the data at the key path.
func (*Postgres) GetProjectKey ¶
GetProjectKey retrieves the object at the key path
func (*Postgres) TranslateError ¶
func (p *Postgres) TranslateError(err error) *TranslatedError
TranslateError translates the database specific error to a simple `error` to return to the user.
type TranslatedError ¶
TranslatedError is a database error translated with HTTP Status code
func NewTranslatedError ¶
func NewTranslatedError(code int, err error) *TranslatedError
NewTranslatedError returns a pointer to a new `TranslatedError`
func (*TranslatedError) Error ¶
func (t *TranslatedError) Error() string