fields

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The database table name for form fields.
	TableName = "form_fields"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Find(formID int) (domain.FormFields, error)
	Insert(formID int, f domain.FormField) error
	Delete(formID int) error
	Exists(formID int, f domain.FormField) bool
}

Repository defines methods for form fields to interact with the database.

type Store

type Store struct {
	*config.Config
}

Store defines the data layer for form fields.

func New

func New(cfg *config.Config) *Store

New

Creates a new meta store.

func (*Store) Delete

func (s *Store) Delete(formID int) error

Delete

Returns nil if the form fields were successfully deleted. Returns errors.INTERNAL if the SQL query was invalid. Returns errors.NOTFOUND if the form field was not found.

func (*Store) Exists

func (s *Store) Exists(formID int, f domain.FormField) bool

Exists

Returns a bool indicating if the form field exists by key. Logs errors.INTERNAL if there was an error executing the query.

func (*Store) Find

func (s *Store) Find(formID int) (domain.FormFields, error)

Find

Returns a slice of form fields belonging to a form. Returns errors.INTERNAL if the SQL query was invalid. Returns errors.NOTFOUND if there are no form fields available.

func (*Store) Insert

func (s *Store) Insert(formID int, f domain.FormField) error

Insert

Checks to see if the form field record exists before updating or creating the new record.

Jump to

Keyboard shortcuts

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