format

package
v0.0.0-...-35d4dbf Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFieldName

func GetFieldName(f *types.Var) string

func GetJSONFieldName

func GetJSONFieldName(tag string, mode options.Mode) string

Types

type AliasFormatter

type AliasFormatter struct {
	TypeFormatterBase
}

func (*AliasFormatter) CanFormat

func (f *AliasFormatter) CanFormat(expr types.Type) bool

func (*AliasFormatter) Constructor

func (f *AliasFormatter) Constructor(fieldName string, expr types.Type) string

func (*AliasFormatter) Declaration

func (f *AliasFormatter) Declaration(fieldName string, expr types.Type) string

func (*AliasFormatter) DefaultValue

func (f *AliasFormatter) DefaultValue(_ types.Type) string

func (*AliasFormatter) Signature

func (f *AliasFormatter) Signature(expr types.Type) string

type ArrayFormatter

type ArrayFormatter struct {
	TypeFormatterBase
}

func (*ArrayFormatter) CanFormat

func (f *ArrayFormatter) CanFormat(expr types.Type) bool

func (*ArrayFormatter) Constructor

func (f *ArrayFormatter) Constructor(fieldName string, _ types.Type) string

func (*ArrayFormatter) Declaration

func (f *ArrayFormatter) Declaration(fieldName string, expr types.Type) string

func (*ArrayFormatter) DefaultValue

func (f *ArrayFormatter) DefaultValue(expr types.Type) string

func (*ArrayFormatter) Signature

func (f *ArrayFormatter) Signature(expr types.Type) string

type MapFormatter

type MapFormatter struct {
	TypeFormatterBase
}

func (*MapFormatter) CanFormat

func (f *MapFormatter) CanFormat(expr types.Type) bool

func (*MapFormatter) Constructor

func (f *MapFormatter) Constructor(fieldName string, _ types.Type) string

func (*MapFormatter) Declaration

func (f *MapFormatter) Declaration(fieldName string, expr types.Type) string

func (*MapFormatter) DefaultValue

func (f *MapFormatter) DefaultValue(expr types.Type) string

func (*MapFormatter) Signature

func (f *MapFormatter) Signature(expr types.Type) string

type PointerFormatter

type PointerFormatter struct {
	TypeFormatterBase
}

func (*PointerFormatter) CanFormat

func (f *PointerFormatter) CanFormat(expr types.Type) bool

func (*PointerFormatter) Constructor

func (f *PointerFormatter) Constructor(fieldName string, _ types.Type) string

func (*PointerFormatter) Declaration

func (f *PointerFormatter) Declaration(fieldName string, expr types.Type) string

func (*PointerFormatter) DefaultValue

func (f *PointerFormatter) DefaultValue(_ types.Type) string

func (*PointerFormatter) Signature

func (f *PointerFormatter) Signature(expr types.Type) string

type PrimitiveFormatter

type PrimitiveFormatter struct {
	TypeFormatterBase
}

func (*PrimitiveFormatter) CanFormat

func (f *PrimitiveFormatter) CanFormat(expr types.Type) bool

func (*PrimitiveFormatter) Constructor

func (f *PrimitiveFormatter) Constructor(fieldName string, _ types.Type) string

func (*PrimitiveFormatter) Declaration

func (f *PrimitiveFormatter) Declaration(fieldName string, expr types.Type) string

func (*PrimitiveFormatter) DefaultValue

func (f *PrimitiveFormatter) DefaultValue(_ types.Type) string

func (*PrimitiveFormatter) Signature

func (f *PrimitiveFormatter) Signature(expr types.Type) string

type StructFormatter

type StructFormatter struct {
	TypeFormatterBase
}

func (*StructFormatter) CanFormat

func (f *StructFormatter) CanFormat(expr types.Type) bool

func (*StructFormatter) Constructor

func (f *StructFormatter) Constructor(fieldName string, _ types.Type) string

func (*StructFormatter) Declaration

func (f *StructFormatter) Declaration(fieldName string, expr types.Type) string

func (*StructFormatter) DefaultValue

func (f *StructFormatter) DefaultValue(_ types.Type) string

func (*StructFormatter) Signature

func (f *StructFormatter) Signature(expr types.Type) string

type TimeFormatter

type TimeFormatter struct {
	TypeFormatterBase
}

func (*TimeFormatter) CanFormat

func (f *TimeFormatter) CanFormat(expr types.Type) bool

func (*TimeFormatter) Constructor

func (f *TimeFormatter) Constructor(fieldName string, _ types.Type) string

func (*TimeFormatter) Declaration

func (f *TimeFormatter) Declaration(fieldName string, expr types.Type) string

func (*TimeFormatter) DefaultValue

func (f *TimeFormatter) DefaultValue(_ types.Type) string

func (*TimeFormatter) Signature

func (f *TimeFormatter) Signature(_ types.Type) string

type TypeFormatter

type TypeFormatter interface {
	SetRegistry(registry *TypeFormatterRegistry)
	CanFormat(expr types.Type) bool
	Signature(expr types.Type) string
	DefaultValue(expr types.Type) string
	Declaration(fieldName string, expr types.Type) string
	Constructor(fieldName string, expr types.Type) string
}

type TypeFormatterBase

type TypeFormatterBase struct {
	Registry *TypeFormatterRegistry
	Mode     options.Mode
}

func (*TypeFormatterBase) SetRegistry

func (t *TypeFormatterBase) SetRegistry(registry *TypeFormatterRegistry)

type TypeFormatterRegistry

type TypeFormatterRegistry struct {
	KnownTypes map[types.Type]struct{}
	Formatters []TypeFormatter
}

func NewTypeFormatterRegistry

func NewTypeFormatterRegistry() *TypeFormatterRegistry

func (*TypeFormatterRegistry) GetTypeFormatter

func (t *TypeFormatterRegistry) GetTypeFormatter(expr types.Type) TypeFormatter

func (*TypeFormatterRegistry) RegisterTypeFormatter

func (t *TypeFormatterRegistry) RegisterTypeFormatter(formatter TypeFormatter)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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