Documentation
¶
Index ¶
- Variables
- func BadRequest(message string) error
- func Error(status int, message string) error
- func NewRequestContext(ctx context.Context, v *http.Request) context.Context
- func ReadRequest(r *http.Request, value interface{}) error
- func RequestFromContext(ctx context.Context) (*http.Request, bool)
- func WriteError(w http.ResponseWriter, err error)
- func WriteResponse(w http.ResponseWriter, value interface{})
- type Field
- type Method
- type ServerError
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var Bool = Type{ Name: "bool", Description: "built-in bool", Fields: nil, PrimaryKey: nil, GoType: "bool", SwiftType: "Bool", SwiftDefault: "false", KotlinType: "Boolean", KotlinDefault: "false", SqlcType: "BOOLEAN", // contains filtered or unexported fields }
View Source
var Float = Type{ Name: "float", Description: "built-in float", Fields: nil, PrimaryKey: nil, GoType: "float64", SwiftType: "Double", SwiftDefault: "0.0", KotlinType: "Double", KotlinDefault: "0.0", SqlcType: "DOUBLE PRECISION", // contains filtered or unexported fields }
View Source
var Int = Type{ Name: "int", Description: "built-in integer", Fields: nil, PrimaryKey: nil, GoType: "int", SwiftType: "Int", SwiftDefault: "0", KotlinType: "Long", KotlinDefault: "0", SqlcType: "BIGINT", // contains filtered or unexported fields }
View Source
var String = Type{ Name: "string", Description: "built-in string", Fields: nil, PrimaryKey: nil, GoType: "string", SwiftType: "String", SwiftDefault: `""`, KotlinType: "String", KotlinDefault: `""`, SqlcType: "TEXT", // contains filtered or unexported fields }
View Source
var Time = Type{ Name: "time", Description: "built-in date", Fields: nil, PrimaryKey: nil, GoType: "*time.Time", SwiftType: "Date", SwiftDefault: "Date()", KotlinType: "Date", KotlinDefault: "Date()", SqlcType: "TIMESTAMPTZ", // contains filtered or unexported fields }
Functions ¶
func NewRequestContext ¶
NewRequestContext returns a new context with ctx.
func ReadRequest ¶
ReadRequest parses application/json request bodies into value, or returns an error.
func RequestFromContext ¶
RequestFromContext returns ctx from context.
func WriteError ¶
func WriteError(w http.ResponseWriter, err error)
WriteError writes an error.
The message in the response uses the Error() implementation.
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, value interface{})
WriteResponse writes a JSON response, or 204 if the value is nil to indicate there is no content.
Types ¶
type Field ¶
type Field struct {
Name string `json:"name"`
CamelName string `json:"camel_name"`
LowerCamelName string `json:"lower_camel_name"`
Description string `json:"description"`
Type Type `json:"type"`
IsArray bool `json:"is_array"`
}
Field model.
func BuiltinTypeFields ¶
type Method ¶
type Method struct {
Name string `json:"name"` // based on filename
CamelName string `json:"camel_name"`
LowerCamelName string `json:"lower_camel_name"`
Description string `json:"description"`
Inputs []Field `json:"inputs"`
Outputs []Field `json:"outputs"`
}
Method model.
type ServerError ¶
ServerError is a server error.
type Type ¶
type Type struct {
Name string `json:"name"` // based on filename
CamelName string `json:"camel_name"`
LowerCamelName string `json:"lower_camel_name"`
Description string `json:"description"`
Fields []Field `json:"fields"`
PrimaryKey []string `json:"primary_key"`
GoPackage string `json:"go_import"`
GoType string `json:"go_type"`
SwiftType string `json:"swift_type"`
SwiftDefault string `json:"swift_default"`
KotlinType string `json:"kotlin_type"`
KotlinDefault string `json:"kotlin_default"`
SqlcType string `json:"sqlc_type"`
// contains filtered or unexported fields
}
Type model.
func (Type) IsInitialized ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
todo
Do not edit, this file was generated by github.com/newlix/core.
|
Do not edit, this file was generated by github.com/newlix/core. |
|
todo/client
Do not edit, this file was generated by github.com/newlix/core.
|
Do not edit, this file was generated by github.com/newlix/core. |
|
todo/cmd/gen
command
|
|
|
todo/server
Do not edit, this file was generated by github.com/newlix/core.
|
Do not edit, this file was generated by github.com/newlix/core. |
|
generators
|
|
Click to show internal directories.
Click to hide internal directories.