templates

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 8 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 IsMultiMessageReceive added in v0.63.0

func IsMultiMessageReceive(op *asyncapi.Operation) bool

IsMultiMessageReceive reports whether the given receive operation carries more than one message and therefore needs per-message subscribe functions and try-each-until-valid dispatch (issue #333). Reply and reply-target operations are excluded as the request/reply path is handled separately.

func MessageTypeName added in v0.61.0

func MessageTypeName(msg *asyncapi.Message) string

MessageTypeName returns the generated Go type name of a message.

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 OperationMessageCount added in v0.61.0

func OperationMessageCount(op *asyncapi.Operation) int

OperationMessageCount returns the number of messages of an operation.

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 ReceivedFuncNameForMessage added in v0.63.0

func ReceivedFuncNameForMessage(op *asyncapi.Operation, msg *asyncapi.Message) string

ReceivedFuncNameForMessage returns the name of the per-message subscriber callback generated when a receive operation carries more than one message (issue #333).

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 SendFuncNameForMessage added in v0.61.0

func SendFuncNameForMessage(op *asyncapi.Operation, prefix string, msg *asyncapi.Message) string

SendFuncNameForMessage returns the name of the per-message send function generated when an operation carries more than one message (issue #140). It is the operation send function name suffixed with "For" and the message name.

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.

func SubscribeFuncNameForMessage added in v0.63.0

func SubscribeFuncNameForMessage(op *asyncapi.Operation, msg *asyncapi.Message) string

SubscribeFuncNameForMessage returns the name of the per-message subscribe function generated when a receive operation carries more than one message (issue #333). It is the operation subscribe function name suffixed with "For" and the message name.

func UnsubscribeFuncNameForMessage added in v0.63.0

func UnsubscribeFuncNameForMessage(op *asyncapi.Operation, msg *asyncapi.Message) string

UnsubscribeFuncNameForMessage returns the name of the per-message unsubscribe function generated when a receive operation carries more than one message (issue #333).

Types

This section is empty.

Jump to

Keyboard shortcuts

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