本文整理汇总了Golang中github.com/goadesign/goa/design.AttributeDefinition.NonZeroAttributes方法的典型用法代码示例。如果您正苦于以下问题:Golang AttributeDefinition.NonZeroAttributes方法的具体用法?Golang AttributeDefinition.NonZeroAttributes怎么用?Golang AttributeDefinition.NonZeroAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/goadesign/goa/design.AttributeDefinition
的用法示例。
在下文中一共展示了AttributeDefinition.NonZeroAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: BaseParams
// BaseParams defines the API base path parameters. These parameters may correspond to wildcards in
// the BasePath or URL query string values.
// The DSL for describing each Param is the Attribute DSL.
func BaseParams(dsl func()) {
params := new(design.AttributeDefinition)
if !dslengine.Execute(dsl, params) {
return
}
params.NonZeroAttributes = make(map[string]bool)
for n := range params.Type.ToObject() {
params.NonZeroAttributes[n] = true
}
if a, ok := apiDefinition(false); ok {
a.BaseParams = params
} else if v, ok := versionDefinition(false); ok {
v.BaseParams = params
} else if r, ok := resourceDefinition(true); ok {
r.BaseParams = params
}
}
示例2: BaseParams
// BaseParams defines the API base path parameters. These parameters may correspond to wildcards in
// the BasePath or URL query string values.
// The DSL for describing each Param is the Attribute DSL.
func BaseParams(dsl func()) {
params := new(design.AttributeDefinition)
if !dslengine.Execute(dsl, params) {
return
}
params.NonZeroAttributes = make(map[string]bool)
for n := range params.Type.ToObject() {
params.NonZeroAttributes[n] = true
}
switch def := dslengine.CurrentDefinition().(type) {
case *design.APIDefinition:
def.BaseParams = params
case *design.ResourceDefinition:
def.BaseParams = params
default:
dslengine.IncompatibleDSL()
}
}