Documentation
¶
Index ¶
- type BaseResponse
- type DropdownRequest
- type DropdownResponse
- type DropdownValue
- type Editable
- type EditableDropdown
- type FormGetRequest
- type FormGetResponse
- type FormSaveRequest
- type FormSaveResponse
- type GridDataRequest
- type GridDataResponse
- type GridRemoveRequest
- type GridReorderRequest
- type GridSaveRequest
- type GridSearch
- type GridSort
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type BaseResponse struct {
Status Status `json:"status"`
Message string `json:"message,omitempty"`
}
func NewErrorResponse ¶
func NewErrorResponse(message string) BaseResponse
func NewSuccessResponse ¶
func NewSuccessResponse() BaseResponse
func (BaseResponse) Write ¶ added in v0.2.0
func (res BaseResponse) Write(w http.ResponseWriter, statusCode int)
type DropdownRequest ¶
func ParseDropdownRequest ¶ added in v0.2.0
func ParseDropdownRequest(request string) (DropdownRequest, error)
type DropdownResponse ¶
func NewDropdownResponse ¶
func NewDropdownResponse[T any](records []T) DropdownResponse[T]
func (DropdownResponse[T]) Write ¶ added in v0.2.0
func (res DropdownResponse[T]) Write(w http.ResponseWriter)
type DropdownValue ¶
type Editable ¶ added in v0.2.0
Editable wraps sql.Null[T] and tracks whether the value was explicitly provided (e.g., via JSON or SQL).
func NewEditable ¶ added in v0.2.0
NewEditable creates a new Editable[T] with Provided set to true but no value set.
func NewEditableWithValue ¶ added in v0.2.0
NewEditableWithValue creates a new Editable[T] with a given value, marked as valid and provided.
func (Editable[T]) IsZero ¶ added in v0.2.0
IsZero implements the json.Zeroed interface. Ensures proper marshalling of Editable values, skipping non-provided values with omitzero tag.
func (Editable[T]) MarshalJSON ¶ added in v0.2.0
MarshalJSON implements the json.Marshaler interface. Ensures proper marshalling of Editable values, representing unset values as null.
func (*Editable[T]) Scan ¶ added in v0.2.0
Scan implements the sql.Scanner interface for Editable. Ensures that Provided flag is set.
func (*Editable[T]) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements the json.Unmarshaler interface. Ensures proper unmarshalling of JSON data, setting the Valid flag based on the JSON data.
type EditableDropdown ¶ added in v0.2.2
func (*EditableDropdown) UnmarshalJSON ¶ added in v0.2.2
func (e *EditableDropdown) UnmarshalJSON(data []byte) error
type FormGetRequest ¶ added in v0.2.0
type FormGetRequest struct {
Action string `json:"action"`
Name string `json:"name"`
RecID int `json:"recid"`
}
func ParseFormGetRequest ¶ added in v0.2.0
func ParseFormGetRequest(request string) (FormGetRequest, error)
type FormGetResponse ¶ added in v0.2.0
type FormGetResponse[T any] struct { Status Status `json:"status"` Record *T `json:"record,omitempty"` }
func NewFormGetResponse ¶ added in v0.2.0
func NewFormGetResponse[T any](record T) FormGetResponse[T]
func (FormGetResponse[T]) Write ¶ added in v0.2.0
func (res FormGetResponse[T]) Write(w http.ResponseWriter)
type FormSaveRequest ¶ added in v0.2.0
type FormSaveRequest[T any] struct { Action string `json:"action"` Name string `json:"name"` RecID int `json:"recid"` Record T `json:"record"` }
func ParseFormSaveRequest ¶ added in v0.2.0
func ParseFormSaveRequest[T any](body io.Reader) (FormSaveRequest[T], error)
type FormSaveResponse ¶ added in v0.2.0
func NewFormSaveResponse ¶ added in v0.2.0
func NewFormSaveResponse(recID int) FormSaveResponse
func (FormSaveResponse) Write ¶ added in v0.2.0
func (res FormSaveResponse) Write(w http.ResponseWriter)
type GridDataRequest ¶
type GridDataRequest struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
SearchLogic string `json:"searchLogic"`
Search []GridSearch `json:"search"`
Sort []GridSort `json:"sort"`
}
func ParseGridDataRequest ¶ added in v0.2.0
func ParseGridDataRequest(request string) (GridDataRequest, error)
type GridDataResponse ¶
type GridDataResponse[T any, V any] struct { Status Status `json:"status"` Records []T `json:"records,omitempty"` Summary []V `json:"summary,omitempty"` Total int `json:"total,omitempty"` }
func NewGridDataResponse ¶
func NewGridDataResponse[T any](records []T, total int) GridDataResponse[T, any]
func NewGridDataResponseWithSummary ¶
func NewGridDataResponseWithSummary[T any, V any](records []T, summary []V, total int) GridDataResponse[T, V]
func (GridDataResponse[T, V]) Write ¶ added in v0.2.0
func (res GridDataResponse[T, V]) Write(w http.ResponseWriter)
type GridRemoveRequest ¶
type GridRemoveRequest struct {
ID []int `json:"id"`
}
func ParseGridRemoveRequest ¶ added in v0.2.0
func ParseGridRemoveRequest(body io.Reader) (GridRemoveRequest, error)
type GridReorderRequest ¶
func ParseGridReorderRequest ¶ added in v0.2.0
func ParseGridReorderRequest(body io.Reader) (GridReorderRequest, error)
func (GridReorderRequest) MarshalJSON ¶ added in v0.2.0
func (req GridReorderRequest) MarshalJSON() ([]byte, error)
func (*GridReorderRequest) UnmarshalJSON ¶ added in v0.2.0
func (req *GridReorderRequest) UnmarshalJSON(data []byte) error
type GridSaveRequest ¶
type GridSaveRequest[T any] struct { Changes []T `json:"changes"` }
func ParseGridSaveRequest ¶ added in v0.2.0
func ParseGridSaveRequest[T any](body io.Reader) (GridSaveRequest[T], error)