Documentation
¶
Index ¶
- Constants
- Variables
- type Repository
- type Store
- func (s *Store) Create(f domain.Form) (domain.Form, error)
- func (s *Store) Delete(id int) error
- func (s *Store) Find(id int) (domain.Form, error)
- func (s *Store) FindByUUID(uniq uuid.UUID) (domain.Form, error)
- func (s *Store) List(meta params.Params) (domain.Forms, int, error)
- func (s *Store) Submit(f domain.FormSubmission) error
- func (s *Store) Update(f domain.Form) (domain.Form, error)
Constants ¶
const ( // The database table name for forms. TableName = "forms" // The database table name for form fields. FieldsTableName = "form_fields" )
Variables ¶
var ( // ErrFormExists is returned by validate when // a form already exists. ErrFormExists = errors.New("form already exists") )
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { List(meta params.Params) (domain.Forms, int, error) Find(id int) (domain.Form, error) FindByUUID(uniq uuid.UUID) (domain.Form, error) Create(f domain.Form) (domain.Form, error) Update(f domain.Form) (domain.Form, error) Delete(id int) error Submit(f domain.FormSubmission) error }
Repository defines methods for forms to interact with the database.
type Store ¶
Store defines the data layer for forms.
func (*Store) Create ¶
Create
Returns a new form upon creation. Returns errors.CONFLICT if the the form (name) already exists. Returns errors.INTERNAL if the SQL query was invalid or the function could not get the newly created ID.
func (*Store) Delete ¶
Delete
Returns nil if the fork was successfully deleted. Returns errors.NOTFOUND if the form was not found. Returns errors.INTERNAL if the SQL query was invalid.
func (*Store) Find ¶
Find
Returns a form by searching with the given ID. Returns errors.INTERNAL if there was an error executing the query. Returns errors.NOTFOUND if the form was not found by the given ID.
func (*Store) FindByUUID ¶
FindByUUID
Returns a form by searching with the given UUID. Returns errors.INTERNAL if there was an error executing the query. Returns errors.NOTFOUND if the form was not found by the given slug.
func (*Store) List ¶
List
Returns a slice of forms with the total amount. Returns errors.INTERNAL if the SQL query was invalid. Returns errors.NOTFOUND if there are no forms available.