format

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package formt defines utilities for formatting Struct field values

Index

Constants

View Source
const (
	TagName = "format"
)

Variables

This section is empty.

Functions

func IsValidTagKey added in v0.5.0

func IsValidTagKey(key string) bool

Types

type Tag

type Tag struct {
	Name string //source for output name, is case formater is not defined, use Name otherwise use Name in UpperCamel format

	CaseFormat string

	DateFormat string
	TimeLayout string
	Format     string

	Inline    bool
	Omitempty bool
	Ignore    bool

	//TBD
	Precision int
	Scale     int

	Language string
	// contains filtered or unexported fields
}

func Parse

func Parse(tag reflect.StructTag, names ...string) (*Tag, error)

func (*Tag) CaseFormatName

func (t *Tag) CaseFormatName(defaultCaseFormat text.CaseFormat) string

func (*Tag) FormatFloat

func (t *Tag) FormatFloat(f float64) (string, error)

func (*Tag) FormatName

func (t *Tag) FormatName() string

func (*Tag) FormatTime

func (t *Tag) FormatTime(ts *time.Time) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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