Documentation ¶
Overview ¶
Package comdef provide some common type or constant definitions
Index ¶
- Constants
- Variables
- type BaseFormatter
- type ByteStringWriter
- type Compared
- type DataFormatter
- type Errors
- type Float
- type Float64able
- type Int
- type Int64able
- type IntCheckFunc
- type IntOrFloat
- type Integer
- type MarshalFunc
- type MatchFunc
- type Matcher
- type SafeStringFunc
- type ScalarType
- type SimpleType
- type SortedType
- type StrCheckFunc
- type StringHandleFunc
- type StringHandler
- type StringMatchFunc
- type StringMatcher
- type StringWriteStringer
- type ToStringFunc
- type ToTypeFunc
- type Uint
- type UnmarshalFunc
- type Xint
- type XintOrFloat
Constants ¶
const ( OpEq = "=" OpNeq = "!=" OpLt = "<" OpLte = "<=" OpGt = ">" OpGte = ">=" )
consts for compare operation
const ( SingleQuote = '\'' DoubleQuote = '"' SlashQuote = '\\' SingleQuoteStr = "'" DoubleQuoteStr = `"` SlashQuoteStr = "\\" )
consts quote chars
const ( // CommaStr const define CommaStr = "," // CommaChar define CommaChar = ',' // EqualStr define EqualStr = "=" // EqualChar define EqualChar = '=' // ColonStr define ColonStr = ":" // ColonChar define ColonChar = ':' // SemicolonStr semicolon define SemicolonStr = ";" // SemicolonChar define SemicolonChar = ';' // PathStr define const PathStr = "/" // PathChar define PathChar = '/' // DefaultSep comma string DefaultSep = "," // SpaceChar char SpaceChar = ' ' // SpaceStr string SpaceStr = " " // NewlineChar char NewlineChar = '\n' // NewlineStr string NewlineStr = "\n" )
const NoIdx = -1
NoIdx invalid index or length
Variables ¶
var ErrConvType = errors.New("convert value type error")
ErrConvType error
Functions ¶
This section is empty.
Types ¶
type BaseFormatter ¶
type BaseFormatter struct { // Out formatted to the writer Out io.Writer // Src data(array, map, struct) for format Src any // MaxDepth limit depth for array, map data TODO MaxDepth int // Prefix string for each element Prefix string // Indent string for format each element Indent string // ClosePrefix string for last "]", "}" ClosePrefix string // contains filtered or unexported fields }
BaseFormatter struct
func (*BaseFormatter) BsWriter ¶
func (f *BaseFormatter) BsWriter() ByteStringWriter
BsWriter build and get
type ByteStringWriter ¶
type ByteStringWriter interface { io.Writer io.ByteWriter io.StringWriter fmt.Stringer }
ByteStringWriter interface
type Compared ¶ added in v0.6.11
Compared type. alias of constraints.SortedType
TODO: use type alias, will error on go1.18 Error: types.go:50: interface contains type constraints type Compared = SortedType
type DataFormatter ¶
DataFormatter interface
type Float64able ¶ added in v0.6.15
Float64able interface
type IntOrFloat ¶ added in v0.6.0
IntOrFloat interface type. all int and float types
type SafeStringFunc ¶ added in v0.6.12
SafeStringFunc safe convert value to string
type ScalarType ¶ added in v0.6.0
ScalarType basic interface type.
TIP: has bool type, it cannot be ordered
contains: (x)int, float, ~string, ~bool types
type SimpleType ¶ added in v0.6.11
SimpleType interface type. alias of ScalarType
contains: (x)int, float, ~string, ~bool types
type SortedType ¶ added in v0.6.2
SortedType interface type. same of constraints.Ordered
it can be ordered, that supports the operators < <= >= >.
contains: (x)int, float, ~string types
type StrCheckFunc ¶ added in v0.6.11
StrCheckFunc check func
type StringHandleFunc ¶ added in v0.6.11
StringHandleFunc definition
func (StringHandleFunc) Handle ¶ added in v0.6.11
func (fn StringHandleFunc) Handle(s string) string
Handle satisfies the StringHandler interface
type StringHandler ¶ added in v0.6.11
StringHandler interface
type StringMatchFunc ¶ added in v0.6.10
StringMatchFunc definition
func (StringMatchFunc) Match ¶ added in v0.6.10
func (fn StringMatchFunc) Match(s string) bool
Match satisfies the StringMatcher interface
type StringMatcher ¶ added in v0.6.10
StringMatcher interface
type StringWriteStringer ¶
type StringWriteStringer interface { io.StringWriter fmt.Stringer }
StringWriteStringer interface
type ToStringFunc ¶ added in v0.6.12
ToStringFunc try to convert value to string, return error on fail
type ToTypeFunc ¶ added in v0.6.15
ToTypeFunc convert value to defined type
type XintOrFloat ¶ added in v0.6.0
XintOrFloat interface type. all int, uint and float types