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 ¶ added in v0.4.0
func EasyJSONGenerator(c EasyJsonConfig) gen.Hook
Types ¶
type Annotation ¶ added in v0.2.0
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 Example ¶ added in v0.4.0
func Example(v interface{}) Annotation
Example returns an example annotation.
func ExcludeEdge ¶ added in v0.4.0
func ExcludeEdge() Annotation
ExcludeEdge returns a Exclude annotation.
func ExposeEdge ¶ added in v0.4.0
func ExposeEdge() Annotation
ExposeEdge returns a Expose annotation.
func Groups ¶ added in v0.2.0
func Groups(gs ...string) Annotation
Groups returns a groups annotation.
func MaxDepth ¶ added in v0.2.1
func MaxDepth(d uint) Annotation
MaxDepth returns a max depth annotation.
func (*Annotation) Decode ¶ added in v0.2.0
func (a *Annotation) Decode(o interface{}) error
Decode from ent.
func (*Annotation) EnsureDefaults ¶ added in v0.2.0
func (a *Annotation) EnsureDefaults()
EnsureDefaults ensures defaults are set.
func (Annotation) Merge ¶ added in v0.2.1
func (a Annotation) Merge(o schema.Annotation) schema.Annotation
Merge implements ent.Merger interface.
func (Annotation) Name ¶ added in v0.2.0
func (Annotation) Name() string
Name implements ent.Annotation interface.
type Config ¶ added in v0.4.0
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 ¶ added in v0.3.2
type Extension ¶ added in v0.2.0
type Extension struct { entc.DefaultExtension // contains filtered or unexported fields }
Extension implements entc.Extension interface for providing http handler code generation.
func NewExtension ¶ added in v0.2.0
func NewExtension(opts ...ExtensionOption) (*Extension, error)
NewExtension returns a new elk extension with default values.
func (*Extension) Annotations ¶ added in v0.4.0
func (e *Extension) Annotations() []entc.Annotation
Annotations of the Extension.
func (*Extension) SpecGenerator ¶ added in v0.4.0
SpecGenerator TODO
type ExtensionOption ¶ added in v0.2.0
ExtensionOption allows managing Extension configuration using functional arguments.
func DefaultHandlerPolicy ¶ added in v0.4.0
func DefaultHandlerPolicy(p Policy) ExtensionOption
DefaultHandlerPolicy sets the policy.Policy to use of none is given on a (sub-)schema.
func GenerateHandlers ¶ added in v0.4.0
func GenerateHandlers(opts ...HandlerOption) ExtensionOption
GenerateHandlers enables generation of http crud handlers.
func GenerateSpec ¶ added in v0.4.0
func GenerateSpec(out string, hooks ...Hook) ExtensionOption
GenerateSpec enables the OpenAPI-Spec generator. Data will be written to given filename.
type GenerateFunc ¶ added in v0.4.0
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 ¶ added in v0.4.0
type HandlerOption ExtensionOption
HandlerOption allows managing RESTGenerator configuration using function arguments.
func HandlerEasyJsonConfig ¶ added in v0.4.0
func HandlerEasyJsonConfig(c EasyJsonConfig) HandlerOption
HandlerEasyJsonConfig sets a custom EasyJsonConfig.
type Hook ¶ added in v0.4.0
Hook defines the "spec generate middleware".
func SpecDescription ¶ added in v0.4.0
SpecDescription sets the title of the Info block.
func SpecSecurity ¶ added in v0.4.0
SpecSecurity sets the global security Spec.
func SpecSecuritySchemes ¶ added in v0.4.0
func SpecSecuritySchemes(schemes map[string]spec.SecurityScheme) Hook
SpecSecuritySchemes sets the security schemes of the Components block.
func SpecVersion ¶ added in v0.4.0
SpecVersion sets the version of the Info block.
type SchemaAnnotation ¶ added in v0.2.0
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 ¶ added in v0.2.1
func CreateGroups(gs ...string) SchemaAnnotation
CreateGroups returns a creation groups schema-annotation.
func CreatePolicy ¶ added in v0.4.0
func CreatePolicy(p Policy) SchemaAnnotation
CreatePolicy returns a creation policy schema-annotation.
func CreateSecurity ¶ added in v0.4.0
func CreateSecurity(s spec.Security) SchemaAnnotation
CreateSecurity returns a create-security schema-annotation.
func DeletePolicy ¶ added in v0.4.0
func DeletePolicy(p Policy) SchemaAnnotation
DeletePolicy returns a delete policy schema-annotation.
func DeleteSecurity ¶ added in v0.4.0
func DeleteSecurity(s spec.Security) SchemaAnnotation
DeleteSecurity returns a delete-security schema-annotation.
func ListGroups ¶ added in v0.2.1
func ListGroups(gs ...string) SchemaAnnotation
ListGroups returns a list groups schema-annotation.
func ListPolicy ¶ added in v0.4.0
func ListPolicy(p Policy) SchemaAnnotation
ListPolicy returns a list policy schema-annotation.
func ListSecurity ¶ added in v0.4.0
func ListSecurity(s spec.Security) SchemaAnnotation
ListSecurity returns a list-security schema-annotation.
func ReadGroups ¶ added in v0.2.1
func ReadGroups(gs ...string) SchemaAnnotation
ReadGroups returns a read groups schema-annotation.
func ReadPolicy ¶ added in v0.4.0
func ReadPolicy(p Policy) SchemaAnnotation
ReadPolicy returns a read policy schema-annotation.
func ReadSecurity ¶ added in v0.4.0
func ReadSecurity(s spec.Security) SchemaAnnotation
ReadSecurity returns a read-security schema-annotation.
func SchemaPolicy ¶ added in v0.4.0
func SchemaPolicy(p Policy) SchemaAnnotation
SchemaPolicy returns a schema-annotation with all operation-policies set to the given one.
func SchemaSecurity ¶ added in v0.4.0
func SchemaSecurity(s spec.Security) SchemaAnnotation
SchemaSecurity sets the given security on all schema operations.
func UpdateGroups ¶ added in v0.2.1
func UpdateGroups(gs ...string) SchemaAnnotation
UpdateGroups returns an update groups schema-annotation.
func UpdatePolicy ¶ added in v0.4.0
func UpdatePolicy(p Policy) SchemaAnnotation
UpdatePolicy returns an update policy schema-annotation.
func UpdateSecurity ¶ added in v0.4.0
func UpdateSecurity(s spec.Security) SchemaAnnotation
UpdateSecurity returns an update-security schema-annotation.
func (*SchemaAnnotation) Decode ¶ added in v0.2.0
func (a *SchemaAnnotation) Decode(o interface{}) error
Decode from ent.
func (SchemaAnnotation) Merge ¶ added in v0.2.1
func (a SchemaAnnotation) Merge(o schema.Annotation) schema.Annotation
Merge implements ent.Merger interface.
func (SchemaAnnotation) Name ¶ added in v0.2.0
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. |