Documentation
¶
Index ¶
- Variables
- func EasyJSONGenerator(c EasyJsonConfig) gen.Hook
- type Annotation
- type Config
- type EasyJsonConfig
- type Edge
- type Edges
- type Extension
- type ExtensionOption
- type GenerateFunc
- type Generator
- type HandlerOption
- type Hook
- type Policy
- type SchemaAnnotation
- func CreateGroups(gs ...string) SchemaAnnotation
- func CreatePolicy(p Policy) SchemaAnnotation
- func CreateSecurity(s spec.Security) SchemaAnnotation
- func DeletePolicy(p Policy) SchemaAnnotation
- func DeleteSecurity(s spec.Security) SchemaAnnotation
- func ListGroups(gs ...string) SchemaAnnotation
- func ListPolicy(p Policy) SchemaAnnotation
- func ListSecurity(s spec.Security) SchemaAnnotation
- func ReadGroups(gs ...string) SchemaAnnotation
- func ReadPolicy(p Policy) SchemaAnnotation
- func ReadSecurity(s spec.Security) SchemaAnnotation
- func SchemaPolicy(p Policy) SchemaAnnotation
- func SchemaSecurity(s spec.Security) SchemaAnnotation
- func UpdateGroups(gs ...string) SchemaAnnotation
- func UpdatePolicy(p Policy) SchemaAnnotation
- func UpdateSecurity(s spec.Security) SchemaAnnotation
Constants ¶
This section is empty.
Variables ¶
var ( // Funcs contains the extra template functions used by elk. Funcs = template.FuncMap{ "contains": contains, "edges": edges, "filterEdges": filterEdges, "filterNodes": filterNodes, "imports": imports, "kebab": strcase.KebabCase, "needsValidation": needsValidation, "nodeOperations": nodeOperations, "pluralize": rules.Pluralize, "view": newView, "views": newViews, "stringSlice": stringSlice, "xextend": xextend, "zapField": zapField, } // HTTPTemplate holds all templates for generating http handlers. HTTPTemplate = gen.MustParse(gen.NewTemplate("elk").Funcs(Funcs).ParseFS(templateDir, "template/http/*.tmpl")) )
Functions ¶
func EasyJSONGenerator ¶
func EasyJSONGenerator(c EasyJsonConfig) gen.Hook
Types ¶
type Annotation ¶
type Annotation struct {
// Groups holds the serialization groups to use on this field / edge.
Groups serialization.Groups
// MaxDepth tells the generator the maximum depth of this field when there is a cycle possible.
MaxDepth uint
// Expose defines if a read/list for this edge should be generated.
Expose Policy
// OpenAPI spec example value on schema fields.
Example interface{}
// OpenAPI security object for the read/list operation on this edge.
Security spec.Security
}
Annotation annotates fields and edges with metadata for templates.
func (*Annotation) EnsureDefaults ¶
func (a *Annotation) EnsureDefaults()
EnsureDefaults ensures defaults are set.
func (Annotation) Merge ¶
func (a Annotation) Merge(o schema.Annotation) schema.Annotation
Merge implements ent.Merger interface.
type Config ¶
type Config struct {
// HandlerPolicy defines the default policy for handler generation.
// It is used if no policy is set on a (sub-)resource.
// Defaults to policy.Expose.
HandlerPolicy Policy
}
type EasyJsonConfig ¶
type Extension ¶
type Extension struct {
entc.DefaultExtension
// contains filtered or unexported fields
}
Extension implements entc.Extension interface for providing http handler code generation.
func NewExtension ¶
func NewExtension(opts ...ExtensionOption) (*Extension, error)
NewExtension returns a new elk extension with default values.
func (*Extension) Annotations ¶
func (e *Extension) Annotations() []entc.Annotation
Annotations of the Extension.
func (*Extension) SpecGenerator ¶
SpecGenerator TODO
type ExtensionOption ¶
ExtensionOption allows managing Extension configuration using functional arguments.
func DefaultHandlerPolicy ¶
func DefaultHandlerPolicy(p Policy) ExtensionOption
DefaultHandlerPolicy sets the policy.Policy to use of none is given on a (sub-)schema.
func GenerateHandlers ¶
func GenerateHandlers(opts ...HandlerOption) ExtensionOption
GenerateHandlers enables generation of http crud handlers.
func GenerateSpec ¶
func GenerateSpec(out string, hooks ...Hook) ExtensionOption
GenerateSpec enables the OpenAPI-Spec generator. Data will be written to given filename.
type GenerateFunc ¶
The GenerateFunc type is an adapter to allow the use of ordinary function as Generator. If f is a function with the appropriate signature, GenerateFunc(f) is a Generator that calls f.
type HandlerOption ¶
type HandlerOption ExtensionOption
HandlerOption allows managing RESTGenerator configuration using function arguments.
func HandlerEasyJsonConfig ¶
func HandlerEasyJsonConfig(c EasyJsonConfig) HandlerOption
HandlerEasyJsonConfig sets a custom EasyJsonConfig.
type Hook ¶
Hook defines the "spec generate middleware".
func SpecDescription ¶
SpecDescription sets the title of the Info block.
func SpecSecurity ¶
SpecSecurity sets the global security Spec.
func SpecSecuritySchemes ¶
func SpecSecuritySchemes(schemes map[string]spec.SecurityScheme) Hook
SpecSecuritySchemes sets the security schemes of the Components block.
type SchemaAnnotation ¶
type SchemaAnnotation struct {
// CreatePolicy defines if a creation handler should be generated.
CreatePolicy Policy
// ReadPolicy defines if a read handler should be generated.
ReadPolicy Policy
// UpdatePolicy defines if an update handler should be generated.
UpdatePolicy Policy
// DeletePolicy defines if a delete handler should be generated.
DeletePolicy Policy
// ListPolicy defines if a list handler should be generated.
ListPolicy Policy
// CreateGroups holds the serializations groups to use on the creation handler.
CreateGroups serialization.Groups
// ReadGroups holds the serializations groups to use on the read handler.
ReadGroups serialization.Groups
// UpdateGroups holds the serializations groups to use on the update handler.
UpdateGroups serialization.Groups
// ListGroups holds the serializations groups to use on the list handler.
ListGroups serialization.Groups
// CreateSecurity sets the security property of the operation in the generated OpenAPI Spec.
CreateSecurity spec.Security
// ReadSecurity sets the security property of the operation in the generated OpenAPI Spec.
ReadSecurity spec.Security
// UpdateSecurity sets the security property of the operation in the generated OpenAPI Spec.
UpdateSecurity spec.Security
// DeleteSecurity sets the security property of the operation in the generated OpenAPI Spec.
DeleteSecurity spec.Security
// ListSecurity sets the security property of the operation in the generated OpenAPI Spec.
ListSecurity spec.Security
}
SchemaAnnotation annotates an entity with metadata for templates.
func CreateGroups ¶
func CreateGroups(gs ...string) SchemaAnnotation
CreateGroups returns a creation groups schema-annotation.
func CreatePolicy ¶
func CreatePolicy(p Policy) SchemaAnnotation
CreatePolicy returns a creation policy schema-annotation.
func CreateSecurity ¶
func CreateSecurity(s spec.Security) SchemaAnnotation
CreateSecurity returns a create-security schema-annotation.
func DeletePolicy ¶
func DeletePolicy(p Policy) SchemaAnnotation
DeletePolicy returns a delete policy schema-annotation.
func DeleteSecurity ¶
func DeleteSecurity(s spec.Security) SchemaAnnotation
DeleteSecurity returns a delete-security schema-annotation.
func ListGroups ¶
func ListGroups(gs ...string) SchemaAnnotation
ListGroups returns a list groups schema-annotation.
func ListPolicy ¶
func ListPolicy(p Policy) SchemaAnnotation
ListPolicy returns a list policy schema-annotation.
func ListSecurity ¶
func ListSecurity(s spec.Security) SchemaAnnotation
ListSecurity returns a list-security schema-annotation.
func ReadGroups ¶
func ReadGroups(gs ...string) SchemaAnnotation
ReadGroups returns a read groups schema-annotation.
func ReadPolicy ¶
func ReadPolicy(p Policy) SchemaAnnotation
ReadPolicy returns a read policy schema-annotation.
func ReadSecurity ¶
func ReadSecurity(s spec.Security) SchemaAnnotation
ReadSecurity returns a read-security schema-annotation.
func SchemaPolicy ¶
func SchemaPolicy(p Policy) SchemaAnnotation
SchemaPolicy returns a schema-annotation with all operation-policies set to the given one.
func SchemaSecurity ¶
func SchemaSecurity(s spec.Security) SchemaAnnotation
SchemaSecurity sets the given security on all schema operations.
func UpdateGroups ¶
func UpdateGroups(gs ...string) SchemaAnnotation
UpdateGroups returns an update groups schema-annotation.
func UpdatePolicy ¶
func UpdatePolicy(p Policy) SchemaAnnotation
UpdatePolicy returns an update policy schema-annotation.
func UpdateSecurity ¶
func UpdateSecurity(s spec.Security) SchemaAnnotation
UpdateSecurity returns an update-security schema-annotation.
func (*SchemaAnnotation) Decode ¶
func (a *SchemaAnnotation) Decode(o interface{}) error
Decode from ent.
func (SchemaAnnotation) Merge ¶
func (a SchemaAnnotation) Merge(o schema.Annotation) schema.Annotation
Merge implements ent.Merger interface.
func (SchemaAnnotation) Name ¶
func (SchemaAnnotation) Name() string
Name implements ent.Annotation interface.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
client_gen/ent/stub
Package stub provides primitives to interact with the openapi HTTP API.
|
Package stub provides primitives to interact with the openapi HTTP API. |
|
fridge
command
|
|