templates

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelToMessageTypeName

func ChannelToMessageTypeName(ch asyncapi.Channel) (string, error)

ChannelToMessageTypeName will convert a channel to a message type name in the form of golang conventional type names.

func DefaultLiteral added in v0.56.0

func DefaultLiteral(s *asyncapi.Schema) string

DefaultLiteral returns the Go literal for the schema's default value, typed to match the field type produced by the "schema-name" template. It assumes HasScalarDefault returned true for the schema.

func GenerateChannelAddr

func GenerateChannelAddr(ch *asyncapi.Channel) string

GenerateChannelAddr will generate a channel path with the given channel.

func GenerateChannelAddrFromOp

func GenerateChannelAddrFromOp(op asyncapi.Operation) string

GenerateChannelAddrFromOp will generate a channel path with the given operation.

func HasScalarDefault added in v0.56.0

func HasScalarDefault(s *asyncapi.Schema) bool

HasScalarDefault reports whether the schema declares a default value that can be rendered as a Go scalar literal (string, boolean, integer or number). Date/time strings, objects, arrays and other complex defaults are not supported and return false.

func HelpersFunctions

func HelpersFunctions() template.FuncMap

HelpersFunctions returns the functions that can be used as helpers in a golang template.

func OpToChannelTypeName

func OpToChannelTypeName(op asyncapi.Operation) string

OpToChannelTypeName will convert an operation to a channel type name in the form of golang conventional type names.

func OpToMsgTypeName

func OpToMsgTypeName(op asyncapi.Operation) (string, error)

OpToMsgTypeName will convert an operation to a message type name in the form of golang conventional type names.

func ReceivedFuncName added in v0.57.0

func ReceivedFuncName(op *asyncapi.Operation) string

ReceivedFuncName returns the Go name of the subscriber callback generated for the given operation, honoring the x-go-received-func override.

func ReplyFuncName added in v0.57.0

func ReplyFuncName(op *asyncapi.Operation) string

ReplyFuncName returns the Go name of the ReplyTo function generated for the given operation, honoring the x-go-reply-func override.

func RequestFuncName added in v0.57.0

func RequestFuncName(op *asyncapi.Operation, prefix string) string

RequestFuncName returns the Go name of the Request function generated for the given operation, honoring the x-go-request-func override. The prefix is the controller side ("App" or "User"), which selects the default "RequestAs"/"RequestTo" verb.

func SendFuncName added in v0.57.0

func SendFuncName(op *asyncapi.Operation, prefix string) string

SendFuncName returns the Go name of the Send function generated for the given operation, honoring the x-go-send-func override. The prefix is the controller side ("App" or "User"), which selects the default "SendAs"/"SendTo" verb.

func SubscribeFuncName added in v0.57.0

func SubscribeFuncName(op *asyncapi.Operation) string

SubscribeFuncName returns the Go name of the SubscribeTo function generated for the given operation, honoring the x-go-subscribe-func override.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL