Documentation
¶
Index ¶
- func ExtractColumnName(cond string) string
- func GetHeadSpecHeaders() []string
- func IsSQLExpression(cond string) bool
- func IsSQLKeyword(word string) bool
- func IsTrivialCondition(cond string) bool
- func ProcessCRUDRequest(handler CRUDHandler, w ResponseWriter, r Request, params map[string]string)
- func ProcessMetadataRequest(handler CRUDHandler, w ResponseWriter, r Request, params map[string]string)
- func QuoteIdent(qualifier string) string
- func QuoteLiteral(value string) string
- func SanitizeWhereClause(where string, tableName string) string
- func SetCORSHeaders(w ResponseWriter, config CORSConfig)
- func ShouldUseNestedProcessor(data map[string]interface{}, model interface{}, ...) bool
- func ToJSONDT(dt time.Time) string
- func TryIfInt64(v any, def int64) int64
- func ValidateAndFixPreloadWhere(where string, relationName string) (string, error)
- func WrapHTTPRequest(w http.ResponseWriter, r *http.Request) (ResponseWriter, Request)
- type APIError
- type CORSConfig
- type CRUDHandler
- type CRUDRequestProvider
- type Column
- type ColumnValidator
- func (v *ColumnValidator) FilterRequestOptions(options RequestOptions) RequestOptions
- func (v *ColumnValidator) FilterValidColumns(columns []string) []string
- func (v *ColumnValidator) GetValidColumns() []string
- func (v *ColumnValidator) IsValidColumn(column string) bool
- func (v *ColumnValidator) ValidateColumn(column string) error
- func (v *ColumnValidator) ValidateColumns(columns []string) error
- func (v *ColumnValidator) ValidateRequestOptions(options RequestOptions) error
- type ComputedColumn
- type CustomOperator
- type Database
- type DeleteQuery
- type FilterOption
- type HTTPHandlerFunc
- type InsertQuery
- type Metadata
- type ModelRegistry
- type NestedCUDProcessor
- type Parameter
- type PreloadOption
- type PrimaryKeyNameProvider
- type ProcessResult
- type QueryHandler
- type RelationshipInfo
- type RelationshipInfoProvider
- type Request
- type RequestBody
- type RequestOptions
- type Response
- type ResponseWriter
- type Result
- type RouteRegistration
- type Router
- type SchemaProvider
- type SelectQuery
- type SortOption
- type SpecHandler
- type SqlDate
- type SqlFloat64
- type SqlInt16
- type SqlInt32
- type SqlInt64
- type SqlJSONB
- type SqlTime
- type SqlTimeStamp
- func (t SqlTimeStamp) Format(layout string) string
- func (t SqlTimeStamp) GetTime() time.Time
- func (t SqlTimeStamp) MarshalJSON() ([]byte, error)
- func (t *SqlTimeStamp) Scan(value interface{}) error
- func (t *SqlTimeStamp) SetTime(pTime time.Time)
- func (t SqlTimeStamp) String() string
- func (t *SqlTimeStamp) UnmarshalJSON(b []byte) error
- func (t SqlTimeStamp) Value() (driver.Value, error)
- type SqlUUID
- type StandardRequest
- func (s *StandardRequest) AllHeaders() map[string]string
- func (s *StandardRequest) AllQueryParams() map[string]string
- func (s *StandardRequest) Body() ([]byte, error)
- func (s *StandardRequest) Header(key string) string
- func (s *StandardRequest) Method() string
- func (s *StandardRequest) PathParam(key string) string
- func (s *StandardRequest) QueryParam(key string) string
- func (s *StandardRequest) URL() string
- func (s *StandardRequest) UnderlyingRequest() *http.Request
- type StandardResponseWriter
- func (s *StandardResponseWriter) SetHeader(key, value string)
- func (s *StandardResponseWriter) UnderlyingResponseWriter() http.ResponseWriter
- func (s *StandardResponseWriter) Write(data []byte) (int, error)
- func (s *StandardResponseWriter) WriteHeader(statusCode int)
- func (s *StandardResponseWriter) WriteJSON(data interface{}) error
- type TableAliasProvider
- type TableMetadata
- type TableNameProvider
- type UpdateQuery
- type ValidateAndUnwrapModelResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractColumnName ¶ added in v0.0.50
ExtractColumnName extracts the column name from a WHERE condition For example: "status = 'active'" returns "status"
func GetHeadSpecHeaders ¶ added in v0.0.73
func GetHeadSpecHeaders() []string
GetHeadSpecHeaders returns all headers used by HeadSpec
func IsSQLExpression ¶ added in v0.0.50
IsSQLExpression checks if a condition is a SQL expression that shouldn't be prefixed
func IsSQLKeyword ¶ added in v0.0.50
IsSQLKeyword checks if a string is a SQL keyword that shouldn't be treated as a column name
func IsTrivialCondition ¶ added in v0.0.55
IsTrivialCondition checks if a condition is trivial and always evaluates to true These conditions should be removed from WHERE clauses as they have no filtering effect
func ProcessCRUDRequest ¶ added in v0.0.65
func ProcessCRUDRequest(handler CRUDHandler, w ResponseWriter, r Request, params map[string]string)
ProcessCRUDRequest demonstrates using the CRUDHandler interface which works with resolvespec.Handler and restheadspec.Handler
func ProcessMetadataRequest ¶ added in v0.0.65
func ProcessMetadataRequest(handler CRUDHandler, w ResponseWriter, r Request, params map[string]string)
ProcessMetadataRequest demonstrates getting metadata from CRUD handlers
func QuoteIdent ¶ added in v0.0.23
func QuoteLiteral ¶ added in v0.0.23
func SanitizeWhereClause ¶ added in v0.0.55
SanitizeWhereClause removes trivial conditions and optionally prefixes table/relation names to columns This function should be used everywhere a WHERE statement is sent to ensure clean, efficient SQL
Parameters:
- where: The WHERE clause string to sanitize
- tableName: Optional table/relation name to prefix to column references (empty string to skip prefixing)
Returns:
- The sanitized WHERE clause with trivial conditions removed and columns optionally prefixed
- An empty string if all conditions were trivial or the input was empty
func SetCORSHeaders ¶ added in v0.0.73
func SetCORSHeaders(w ResponseWriter, config CORSConfig)
SetCORSHeaders sets CORS headers on a response writer
func ShouldUseNestedProcessor ¶ added in v0.0.20
func ShouldUseNestedProcessor(data map[string]interface{}, model interface{}, relationshipHelper RelationshipInfoProvider) bool
ShouldUseNestedProcessor determines if we should use nested CUD processing It recursively checks if the data contains: 1. A _request field at any level, OR 2. Nested relations that themselves contain further nested relations or _request fields This ensures nested processing is only used when there are deeply nested operations
func TryIfInt64 ¶ added in v0.0.43
TryIfInt64 - Wrapper function to quickly try and cast text to int
func ValidateAndFixPreloadWhere ¶ added in v0.0.50
ValidateAndFixPreloadWhere validates that the WHERE clause for a preload contains the relation prefix (alias). If not present, it attempts to add it to column references. Returns the fixed WHERE clause and an error if it cannot be safely fixed.
func WrapHTTPRequest ¶ added in v0.0.62
func WrapHTTPRequest(w http.ResponseWriter, r *http.Request) (ResponseWriter, Request)
WrapHTTPRequest wraps standard http.ResponseWriter and *http.Request into common interfaces
Types ¶
type CORSConfig ¶ added in v0.0.73
type CORSConfig struct {
AllowedOrigins []string
AllowedMethods []string
AllowedHeaders []string
MaxAge int
}
CORSConfig holds CORS configuration
func DefaultCORSConfig ¶ added in v0.0.73
func DefaultCORSConfig() CORSConfig
DefaultCORSConfig returns a default CORS configuration suitable for HeadSpec
type CRUDHandler ¶ added in v0.0.65
type CRUDHandler interface {
SpecHandler
// Handle processes API requests through router-agnostic interface
Handle(w ResponseWriter, r Request, params map[string]string)
// HandleGet processes GET requests for metadata
HandleGet(w ResponseWriter, r Request, params map[string]string)
}
CRUDHandler interface for handlers that support CRUD operations This is implemented by resolvespec.Handler and restheadspec.Handler
type CRUDRequestProvider ¶ added in v0.0.20
type CRUDRequestProvider interface {
GetRequest() string
}
CRUDRequestProvider interface for models that provide CRUD request strings
type ColumnValidator ¶
type ColumnValidator struct {
// contains filtered or unexported fields
}
ColumnValidator validates column names against a model's fields
func NewColumnValidator ¶
func NewColumnValidator(model interface{}) *ColumnValidator
NewColumnValidator creates a new column validator for a given model
func (*ColumnValidator) FilterRequestOptions ¶
func (v *ColumnValidator) FilterRequestOptions(options RequestOptions) RequestOptions
FilterRequestOptions filters all column references in RequestOptions Returns a new RequestOptions with only valid columns, logging warnings for invalid ones
func (*ColumnValidator) FilterValidColumns ¶
func (v *ColumnValidator) FilterValidColumns(columns []string) []string
FilterValidColumns filters a list of columns, returning only valid ones Logs warnings for any invalid columns
func (*ColumnValidator) GetValidColumns ¶
func (v *ColumnValidator) GetValidColumns() []string
GetValidColumns returns a list of all valid column names for debugging purposes
func (*ColumnValidator) IsValidColumn ¶
func (v *ColumnValidator) IsValidColumn(column string) bool
IsValidColumn checks if a column is valid Returns true if valid, false if invalid
func (*ColumnValidator) ValidateColumn ¶
func (v *ColumnValidator) ValidateColumn(column string) error
ValidateColumn validates a single column name Returns nil if valid, error if invalid Columns prefixed with "cql" (case insensitive) are always valid Handles PostgreSQL JSON operators (-> and ->>)
func (*ColumnValidator) ValidateColumns ¶
func (v *ColumnValidator) ValidateColumns(columns []string) error
ValidateColumns validates multiple column names Returns error with details about all invalid columns
func (*ColumnValidator) ValidateRequestOptions ¶
func (v *ColumnValidator) ValidateRequestOptions(options RequestOptions) error
ValidateRequestOptions validates all column references in RequestOptions
type ComputedColumn ¶
type CustomOperator ¶
type Database ¶
type Database interface {
// Core query operations
NewSelect() SelectQuery
NewInsert() InsertQuery
NewUpdate() UpdateQuery
NewDelete() DeleteQuery
// Raw SQL execution
Exec(ctx context.Context, query string, args ...interface{}) (Result, error)
Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
// Transaction support
BeginTx(ctx context.Context) (Database, error)
CommitTx(ctx context.Context) error
RollbackTx(ctx context.Context) error
RunInTransaction(ctx context.Context, fn func(Database) error) error
}
Database interface designed to work with both GORM and Bun
func ProcessWithAnyHandler ¶ added in v0.0.65
func ProcessWithAnyHandler(handler SpecHandler) Database
ProcessWithAnyHandler demonstrates using the base SpecHandler interface which works with any handler type (resolvespec, restheadspec, or funcspec)
type DeleteQuery ¶
type DeleteQuery interface {
Model(model interface{}) DeleteQuery
Table(table string) DeleteQuery
Where(query string, args ...interface{}) DeleteQuery
// Execution
Exec(ctx context.Context) (Result, error)
}
DeleteQuery interface for building DELETE queries
type FilterOption ¶
type HTTPHandlerFunc ¶
type HTTPHandlerFunc func(ResponseWriter, Request)
HTTPHandlerFunc type for HTTP handlers
type InsertQuery ¶
type InsertQuery interface {
Model(model interface{}) InsertQuery
Table(table string) InsertQuery
Value(column string, value interface{}) InsertQuery
OnConflict(action string) InsertQuery
Returning(columns ...string) InsertQuery
// Execution
Exec(ctx context.Context) (Result, error)
}
InsertQuery interface for building INSERT queries
type ModelRegistry ¶
type ModelRegistry interface {
RegisterModel(name string, model interface{}) error
GetModel(name string) (interface{}, error)
GetAllModels() map[string]interface{}
GetModelByEntity(schema, entity string) (interface{}, error)
}
ModelRegistry manages model registration and retrieval
type NestedCUDProcessor ¶ added in v0.0.20
type NestedCUDProcessor struct {
// contains filtered or unexported fields
}
NestedCUDProcessor handles recursive processing of nested object graphs
func NewNestedCUDProcessor ¶ added in v0.0.20
func NewNestedCUDProcessor(db Database, registry ModelRegistry, relationshipHelper RelationshipInfoProvider) *NestedCUDProcessor
NewNestedCUDProcessor creates a new nested CUD processor
func (*NestedCUDProcessor) ProcessNestedCUD ¶ added in v0.0.20
func (p *NestedCUDProcessor) ProcessNestedCUD( ctx context.Context, operation string, data map[string]interface{}, model interface{}, parentIDs map[string]interface{}, tableName string, ) (*ProcessResult, error)
ProcessNestedCUD recursively processes nested object graphs for Create, Update, Delete operations with automatic foreign key resolution
type PreloadOption ¶
type PreloadOption struct {
Relation string `json:"relation"`
Columns []string `json:"columns"`
OmitColumns []string `json:"omit_columns"`
Sort []SortOption `json:"sort"`
Filters []FilterOption `json:"filters"`
Where string `json:"where"`
Limit *int `json:"limit"`
Offset *int `json:"offset"`
Updatable *bool `json:"updateable"` // if true, the relation can be updated
ComputedQL map[string]string `json:"computed_ql"` // Computed columns as SQL expressions
Recursive bool `json:"recursive"` // if true, preload recursively up to 5 levels
// Relationship keys from XFiles - used to build proper foreign key filters
PrimaryKey string `json:"primary_key"` // Primary key of the related table
RelatedKey string `json:"related_key"` // For child tables: column in child that references parent
ForeignKey string `json:"foreign_key"` // For parent tables: column in current table that references parent
}
type PrimaryKeyNameProvider ¶
type PrimaryKeyNameProvider interface {
GetIDName() string
}
PrimaryKeyNameProvider interface for models that provide primary key column names
type ProcessResult ¶ added in v0.0.20
type ProcessResult struct {
ID interface{} // The ID of the processed record
AffectedRows int64 // Number of rows affected
Data map[string]interface{} // The processed data
RelationData map[string]interface{} // Data from processed relations
}
ProcessResult contains the result of processing a CUD operation
type QueryHandler ¶ added in v0.0.65
type QueryHandler interface {
SpecHandler
}
QueryHandler interface for handlers that execute SQL queries This is implemented by funcspec.Handler Note: funcspec uses standard http.ResponseWriter and *http.Request instead of common interfaces
type RelationshipInfo ¶ added in v0.0.20
type RelationshipInfo struct {
FieldName string
JSONName string
RelationType string // "belongsTo", "hasMany", "hasOne", "many2many"
ForeignKey string
References string
JoinTable string
RelatedModel interface{}
}
RelationshipInfo contains information about a model relationship
type RelationshipInfoProvider ¶ added in v0.0.20
type RelationshipInfoProvider interface {
GetRelationshipInfo(modelType reflect.Type, relationName string) *RelationshipInfo
}
RelationshipInfoProvider interface for handlers that can provide relationship info
type Request ¶
type Request interface {
Method() string
URL() string
Header(key string) string
AllHeaders() map[string]string // Get all headers as a map
Body() ([]byte, error)
PathParam(key string) string
QueryParam(key string) string
AllQueryParams() map[string]string // Get all query parameters as a map
UnderlyingRequest() *http.Request // Get the underlying *http.Request for forwarding to other handlers
}
Request interface abstracts HTTP request
type RequestBody ¶
type RequestBody struct {
Operation string `json:"operation"`
Data interface{} `json:"data"`
ID *int64 `json:"id"`
Options RequestOptions `json:"options"`
}
type RequestOptions ¶
type RequestOptions struct {
Preload []PreloadOption `json:"preload"`
Columns []string `json:"columns"`
OmitColumns []string `json:"omit_columns"`
Filters []FilterOption `json:"filters"`
Sort []SortOption `json:"sort"`
Limit *int `json:"limit"`
Offset *int `json:"offset"`
CustomOperators []CustomOperator `json:"customOperators"`
ComputedColumns []ComputedColumn `json:"computedColumns"`
Parameters []Parameter `json:"parameters"`
// Cursor pagination
CursorForward string `json:"cursor_forward"`
CursorBackward string `json:"cursor_backward"`
FetchRowNumber *string `json:"fetch_row_number"`
}
type Response ¶
type Response struct {
Success bool `json:"success"`
Data interface{} `json:"data"`
Metadata *Metadata `json:"metadata,omitempty"`
Error *APIError `json:"error,omitempty"`
}
Response structures
type ResponseWriter ¶
type ResponseWriter interface {
SetHeader(key, value string)
WriteHeader(statusCode int)
Write(data []byte) (int, error)
WriteJSON(data interface{}) error
UnderlyingResponseWriter() http.ResponseWriter // Get the underlying http.ResponseWriter for forwarding to other handlers
}
ResponseWriter interface abstracts HTTP response
type RouteRegistration ¶
type RouteRegistration interface {
Methods(methods ...string) RouteRegistration
PathPrefix(prefix string) RouteRegistration
}
RouteRegistration allows method chaining for route configuration
type Router ¶
type Router interface {
HandleFunc(pattern string, handler HTTPHandlerFunc) RouteRegistration
ServeHTTP(w ResponseWriter, r Request)
}
Router interface for HTTP router abstraction
type SchemaProvider ¶
type SchemaProvider interface {
SchemaName() string
}
SchemaProvider interface for models that provide schema names
type SelectQuery ¶
type SelectQuery interface {
Model(model interface{}) SelectQuery
Table(table string) SelectQuery
Column(columns ...string) SelectQuery
ColumnExpr(query string, args ...interface{}) SelectQuery
Where(query string, args ...interface{}) SelectQuery
WhereOr(query string, args ...interface{}) SelectQuery
Join(query string, args ...interface{}) SelectQuery
LeftJoin(query string, args ...interface{}) SelectQuery
Preload(relation string, conditions ...interface{}) SelectQuery
PreloadRelation(relation string, apply ...func(SelectQuery) SelectQuery) SelectQuery
Order(order string) SelectQuery
Limit(n int) SelectQuery
Offset(n int) SelectQuery
Group(group string) SelectQuery
Having(having string, args ...interface{}) SelectQuery
// Execution methods
Scan(ctx context.Context, dest interface{}) error
ScanModel(ctx context.Context) error
Count(ctx context.Context) (int, error)
Exists(ctx context.Context) (bool, error)
}
SelectQuery interface for building SELECT queries (compatible with both GORM and Bun)
type SortOption ¶
type SpecHandler ¶ added in v0.0.65
type SpecHandler interface {
// GetDatabase returns the underlying database connection
GetDatabase() Database
}
SpecHandler interface represents common functionality across all spec handlers This is the base interface implemented by:
- resolvespec.Handler: Handles CRUD operations via request body with explicit operation field
- restheadspec.Handler: Handles CRUD operations via HTTP methods (GET/POST/PUT/DELETE)
- funcspec.Handler: Handles custom SQL query execution with dynamic parameters
The interface hierarchy is:
SpecHandler (base) ├── CRUDHandler (resolvespec, restheadspec) └── QueryHandler (funcspec)
type SqlDate ¶ added in v0.0.42
SqlDate - Implementation of SqlTime with some interfaces.
func SqlDateNow ¶ added in v0.0.42
func SqlDateNow() SqlDate
func (SqlDate) MarshalJSON ¶ added in v0.0.42
MarshalJSON - Override JSON format of time
func (*SqlDate) UnmarshalJSON ¶ added in v0.0.42
UnmarshalJSON - Override JSON format of time
type SqlFloat64 ¶ added in v0.0.42
type SqlFloat64 sql.NullFloat64
SqlFloat64 - SQL Int
func (SqlFloat64) MarshalJSON ¶ added in v0.0.42
func (n SqlFloat64) MarshalJSON() ([]byte, error)
MarshalJSON - Override JSON format of time
func (*SqlFloat64) Scan ¶ added in v0.0.42
func (n *SqlFloat64) Scan(value interface{}) error
Scan -
func (*SqlFloat64) UnmarshalJSON ¶ added in v0.0.42
func (n *SqlFloat64) UnmarshalJSON(b []byte) error
UnmarshalJSON -
type SqlInt16 ¶ added in v0.0.42
type SqlInt16 int16
SqlInt16 - A Int16 that supports SQL string
func (SqlInt16) MarshalJSON ¶ added in v0.0.42
MarshalJSON - Override JSON format of time
func (*SqlInt16) UnmarshalJSON ¶ added in v0.0.42
UnmarshalJSON - Overre JidSON format of ZNullInt32
type SqlInt32 ¶ added in v0.0.42
type SqlInt32 int32
SqlInt32 - A int32 that supports SQL string
func (SqlInt32) MarshalJSON ¶ added in v0.0.42
MarshalJSON - Override JSON format of time
func (*SqlInt32) UnmarshalJSON ¶ added in v0.0.42
UnmarshalJSON - Overre JidSON format of ZNullInt32
type SqlInt64 ¶ added in v0.0.42
type SqlInt64 int64
SqlInt64 - A int64 that supports SQL string
func (SqlInt64) MarshalJSON ¶ added in v0.0.42
MarshalJSON - Override JSON format of time
func (*SqlInt64) UnmarshalJSON ¶ added in v0.0.42
UnmarshalJSON - Overre JidSON format of ZNullInt32
type SqlJSONB ¶ added in v0.0.42
type SqlJSONB []byte
SqlJSONB - Nullable JSONB String
func (SqlJSONB) MarshalJSON ¶ added in v0.0.42
MarshalJSON - Override JSON format of time
func (*SqlJSONB) Scan ¶ added in v0.0.42
Scan - Implements sql.Scanner for reading JSONB from database
func (*SqlJSONB) UnmarshalJSON ¶ added in v0.0.42
UnmarshalJSON - Override JSON
type SqlTime ¶ added in v0.0.42
////////////////////// SqlTime ///////////////////////// SqlTime - Implementation of SqlTime with some interfaces.
func SqlTimeNow ¶ added in v0.0.42
func SqlTimeNow() SqlTime
func (SqlTime) MarshalJSON ¶ added in v0.0.42
MarshalJSON - Override JSON format of time
func (*SqlTime) UnmarshalJSON ¶ added in v0.0.42
UnmarshalJSON - Override JSON format of time
type SqlTimeStamp ¶ added in v0.0.42
SqlTimeStamp - Implementation of SqlTimeStamp with some interfaces.
func SqlTimeStampNow ¶ added in v0.0.42
func SqlTimeStampNow() SqlTimeStamp
func (SqlTimeStamp) Format ¶ added in v0.0.42
func (t SqlTimeStamp) Format(layout string) string
Format - Formats the time
func (SqlTimeStamp) GetTime ¶ added in v0.0.42
func (t SqlTimeStamp) GetTime() time.Time
GetTime - Returns Time
func (SqlTimeStamp) MarshalJSON ¶ added in v0.0.42
func (t SqlTimeStamp) MarshalJSON() ([]byte, error)
MarshalJSON - Override JSON format of time
func (*SqlTimeStamp) Scan ¶ added in v0.0.42
func (t *SqlTimeStamp) Scan(value interface{}) error
Scan - Scan custom date from sql
func (*SqlTimeStamp) SetTime ¶ added in v0.0.42
func (t *SqlTimeStamp) SetTime(pTime time.Time)
SetTime - Returns Time
func (SqlTimeStamp) String ¶ added in v0.0.42
func (t SqlTimeStamp) String() string
String - Override String format of time
func (*SqlTimeStamp) UnmarshalJSON ¶ added in v0.0.42
func (t *SqlTimeStamp) UnmarshalJSON(b []byte) error
UnmarshalJSON - Override JSON format of time
type SqlUUID ¶ added in v0.0.43
type SqlUUID sql.NullString
SqlUUID - Nullable UUID String
func (SqlUUID) MarshalJSON ¶ added in v0.0.43
MarshalJSON - Override JSON format of time
func (*SqlUUID) UnmarshalJSON ¶ added in v0.0.43
UnmarshalJSON - Override JSON
type StandardRequest ¶ added in v0.0.62
type StandardRequest struct {
// contains filtered or unexported fields
}
StandardRequest adapts *http.Request to Request interface
func (*StandardRequest) AllHeaders ¶ added in v0.0.62
func (s *StandardRequest) AllHeaders() map[string]string
func (*StandardRequest) AllQueryParams ¶ added in v0.0.62
func (s *StandardRequest) AllQueryParams() map[string]string
func (*StandardRequest) Body ¶ added in v0.0.62
func (s *StandardRequest) Body() ([]byte, error)
func (*StandardRequest) Header ¶ added in v0.0.62
func (s *StandardRequest) Header(key string) string
func (*StandardRequest) Method ¶ added in v0.0.62
func (s *StandardRequest) Method() string
func (*StandardRequest) PathParam ¶ added in v0.0.62
func (s *StandardRequest) PathParam(key string) string
func (*StandardRequest) QueryParam ¶ added in v0.0.62
func (s *StandardRequest) QueryParam(key string) string
func (*StandardRequest) URL ¶ added in v0.0.62
func (s *StandardRequest) URL() string
func (*StandardRequest) UnderlyingRequest ¶ added in v0.0.72
func (s *StandardRequest) UnderlyingRequest() *http.Request
type StandardResponseWriter ¶ added in v0.0.62
type StandardResponseWriter struct {
// contains filtered or unexported fields
}
StandardResponseWriter adapts http.ResponseWriter to ResponseWriter interface
func (*StandardResponseWriter) SetHeader ¶ added in v0.0.62
func (s *StandardResponseWriter) SetHeader(key, value string)
func (*StandardResponseWriter) UnderlyingResponseWriter ¶ added in v0.0.72
func (s *StandardResponseWriter) UnderlyingResponseWriter() http.ResponseWriter
func (*StandardResponseWriter) Write ¶ added in v0.0.62
func (s *StandardResponseWriter) Write(data []byte) (int, error)
func (*StandardResponseWriter) WriteHeader ¶ added in v0.0.62
func (s *StandardResponseWriter) WriteHeader(statusCode int)
func (*StandardResponseWriter) WriteJSON ¶ added in v0.0.62
func (s *StandardResponseWriter) WriteJSON(data interface{}) error
type TableAliasProvider ¶ added in v0.0.20
type TableAliasProvider interface {
TableAlias() string
}
type TableMetadata ¶
type TableNameProvider ¶
type TableNameProvider interface {
TableName() string
}
TableNameProvider interface for models that provide table names
type UpdateQuery ¶
type UpdateQuery interface {
Model(model interface{}) UpdateQuery
Table(table string) UpdateQuery
Set(column string, value interface{}) UpdateQuery
SetMap(values map[string]interface{}) UpdateQuery
Where(query string, args ...interface{}) UpdateQuery
Returning(columns ...string) UpdateQuery
// Execution
Exec(ctx context.Context) (Result, error)
}
UpdateQuery interface for building UPDATE queries
type ValidateAndUnwrapModelResult ¶ added in v0.0.80
type ValidateAndUnwrapModelResult struct {
ModelType reflect.Type
Model interface{}
ModelPtr interface{}
OriginalType reflect.Type
}
ValidateAndUnwrapModelResult contains the result of model validation
func ValidateAndUnwrapModel ¶ added in v0.0.80
func ValidateAndUnwrapModel(model interface{}) (*ValidateAndUnwrapModelResult, error)
ValidateAndUnwrapModel validates that a model is a struct type and unwraps pointers, slices, and arrays to get to the base struct type. Returns an error if the model is not a valid struct type.