Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateRequest ¶
type AggregateRequest struct {
GroupBy []string `json:"group_by"`
Aggregate map[string]any `json:"aggregate"`
Where map[string]any `json:"where"`
Having map[string]any `json:"having"`
OrderBy map[string]string `json:"order_by"`
}
AggregateRequest represents a request for aggregation
type BatchCreateRequest ¶
type BatchCreateRequest struct {
Data []any `json:"data"`
}
BatchCreateRequest represents a request to create multiple records
type BatchDeleteRequest ¶
BatchDeleteRequest represents a request to delete multiple records
type BatchUpdateRequest ¶
BatchUpdateRequest represents a request to update multiple records
type CreateRequest ¶
type CreateRequest struct {
Data any `json:"data"`
}
CreateRequest represents a request to create a new record
type ErrorDetail ¶
type ErrorDetail struct {
Code string `json:"code"`
Message string `json:"message"`
Details string `json:"details,omitempty"`
}
ErrorDetail contains error information
type Meta ¶
type Meta struct {
ExecutionTime string `json:"execution_time"`
QueryCount int `json:"query_count"`
Timestamp string `json:"timestamp"`
}
Meta contains metadata about the request
type Pagination ¶
type Pagination struct {
Page int `json:"page"`
Limit int `json:"limit"`
Total int `json:"total"`
Pages int `json:"pages"`
}
Pagination contains pagination information
type QueryParams ¶
type QueryParams struct {
// Pagination
Page int `json:"page"`
Limit int `json:"limit"`
// Filtering
Where map[string]any `json:"where"`
Filter map[string]any `json:"filter"`
// Sorting
Sort []string `json:"sort"`
OrderBy []string `json:"order_by"`
// Field selection
Select []string `json:"select"`
Fields []string `json:"fields"`
// Relations
Include any `json:"include"`
// Search
Search string `json:"search"`
Q string `json:"q"`
}
QueryParams represents common query parameters for data operations
func ParseQueryParams ¶
func ParseQueryParams(params map[string][]string) (*QueryParams, error)
ParseQueryParams parses query parameters from URL values
type RawQueryRequest ¶
RawQueryRequest represents a raw SQL/MongoDB query request
type Response ¶
type Response struct {
Success bool `json:"success"`
Data any `json:"data"`
Pagination *Pagination `json:"pagination,omitempty"`
Meta *Meta `json:"meta,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}
Response represents the standard API response format
func NewErrorResponse ¶
NewErrorResponse creates an error response
func NewPaginatedResponse ¶
NewPaginatedResponse creates a paginated response
func NewSuccessResponse ¶
NewSuccessResponse creates a successful response
func (*Response) WithExecutionTime ¶
WithExecutionTime adds execution time to the response
func (*Response) WithQueryCount ¶
WithQueryCount adds query count to the response
type UpdateRequest ¶
type UpdateRequest struct {
Data any `json:"data"`
}
UpdateRequest represents a request to update a record