Documentation
¶
Index ¶
- Variables
- type Client
- type Field
- type Form
- type InMemoryFormSchemaRepo
- func (r *InMemoryFormSchemaRepo) Create(schema *model.FormSchema) (*model.FormSchema, error)
- func (r *InMemoryFormSchemaRepo) Delete(id uint) error
- func (r *InMemoryFormSchemaRepo) Get(id uint) (*model.FormSchema, error)
- func (r *InMemoryFormSchemaRepo) List() ([]*model.FormSchema, error)
- func (r *InMemoryFormSchemaRepo) Update(id uint, schema *model.FormSchema) (*model.FormSchema, error)
- type JSON
- type Options
- type Response
- type SchemaRepository
- type Service
- type Store
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFormSchemaNotFound is returned when a form schema cannot be found ErrFormSchemaNotFound = errors.New("form schema not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
SubmitForm(ctx context.Context, form Form) error
GetForm(ctx context.Context, formID string) (*Form, error)
ListForms(ctx context.Context) ([]Form, error)
DeleteForm(ctx context.Context, formID string) error
UpdateForm(ctx context.Context, formID string, form Form) error
SubmitResponse(ctx context.Context, formID string, response Response) error
GetResponse(ctx context.Context, responseID string) (*Response, error)
ListResponses(ctx context.Context, formID string) ([]Response, error)
DeleteResponse(ctx context.Context, responseID string) error
}
Client represents a form client interface
type Form ¶
type Form struct {
ID string `json:"id"`
UserID uint `json:"user_id"`
Title string `json:"title"`
Description string `json:"description"`
Schema JSON `json:"schema"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Form represents a form in the system
type InMemoryFormSchemaRepo ¶
type InMemoryFormSchemaRepo struct {
// contains filtered or unexported fields
}
InMemoryFormSchemaRepo is a simple in-memory implementation for demo/testing Not safe for concurrent use in production!
func NewInMemoryFormSchemaRepo ¶
func NewInMemoryFormSchemaRepo() *InMemoryFormSchemaRepo
NewInMemoryFormSchemaRepo creates a new in-memory form schema repository
func (*InMemoryFormSchemaRepo) Create ¶
func (r *InMemoryFormSchemaRepo) Create(schema *model.FormSchema) (*model.FormSchema, error)
Create stores a new form schema
func (*InMemoryFormSchemaRepo) Delete ¶
func (r *InMemoryFormSchemaRepo) Delete(id uint) error
Delete removes a form schema by ID
func (*InMemoryFormSchemaRepo) Get ¶
func (r *InMemoryFormSchemaRepo) Get(id uint) (*model.FormSchema, error)
Get retrieves a form schema by ID
func (*InMemoryFormSchemaRepo) List ¶
func (r *InMemoryFormSchemaRepo) List() ([]*model.FormSchema, error)
List returns all form schemas
func (*InMemoryFormSchemaRepo) Update ¶
func (r *InMemoryFormSchemaRepo) Update(id uint, schema *model.FormSchema) (*model.FormSchema, error)
Update modifies an existing form schema
type SchemaRepository ¶
type SchemaRepository interface {
List() ([]*model.FormSchema, error)
Create(schema *model.FormSchema) (*model.FormSchema, error)
Get(id uint) (*model.FormSchema, error)
Update(id uint, schema *model.FormSchema) (*model.FormSchema, error)
Delete(id uint) error
}
SchemaRepository defines the interface for form schema storage
type Service ¶
type Service interface {
CreateForm(userID uint, title, description string, schema JSON) (*Form, error)
GetForm(id string) (*Form, error)
GetUserForms(userID uint) ([]*Form, error)
UpdateForm(form *Form) error
DeleteForm(id string) error
GetFormSubmissions(formID string) ([]*model.FormSubmission, error)
}
Service defines the interface for form operations
func NewService ¶
NewService creates a new form service instance
type Store ¶
type Store interface {
Create(f *Form) error
GetByID(id string) (*Form, error)
GetByUserID(userID uint) ([]*Form, error)
Delete(id string) error
Update(f *Form) error
GetFormSubmissions(formID string) ([]*model.FormSubmission, error)
}
Store defines the interface for form storage operations