templates

package
v0.21.4 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Args added in v0.19.2

func Args(vs ...any) []any

Args is a function used to pass arguments to templates.

func ChannelToMessageTypeName

func ChannelToMessageTypeName(ch asyncapi.Channel) string

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

func DescribeStruct added in v0.10.1

func DescribeStruct(st any) string

DescribeStruct will describe a struct in a human readable way using `%+v` format from the standard library.

func GenerateChannelPath added in v0.9.0

func GenerateChannelPath(ch asyncapi.Channel) string

GenerateChannelPath will generate a channel path with the given channel.

func HasField

func HasField(v interface{}, name string) bool

HasField will check if a struct has a field with the given name.

func IsRequired added in v0.4.0

func IsRequired(schema asyncapi.Schema, field string) bool

IsRequired will check if a field is required in a asyncapi struct.

func MultiLineComment added in v0.10.1

func MultiLineComment(comment string) string

MultiLineComment will prefix each line of a comment with "// " in order to make it a valid multiline golang comment.

func Namify

func Namify(sentence string) string

Namify will convert a sentence to a golang conventional type name.

func ReferenceToStructAttributePath

func ReferenceToStructAttributePath(ref string) string

ReferenceToStructAttributePath will convert a reference to a struct attribute path in the form of "a.b.c" where a, b and c are struct attributes in the form of golang conventional type names.

func ReferenceToTypeName

func ReferenceToTypeName(ref string) string

ReferenceToTypeName will convert a reference to a type name in the form of golang conventional type names.

func SnakeCase

func SnakeCase(sentence string) string

SnakeCase will convert a sentence to snake case.

Types

This section is empty.

Jump to

Keyboard shortcuts

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