comdef

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Package comdef provide some common type or constant definitions

Index

Constants

View Source
const (
	OpEq  = "="
	OpNeq = "!="
	OpLt  = "<"
	OpLte = "<="
	OpGt  = ">"
	OpGte = ">="
)

consts for compare operation

View Source
const (
	SingleQuote = '\''
	DoubleQuote = '"'
	SlashQuote  = '\\'

	SingleQuoteStr = "'"
	DoubleQuoteStr = `"`
	SlashQuoteStr  = "\\"
)

consts quote chars

View Source
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"
)
View Source
const NoIdx = -1

NoIdx invalid index or length

Variables

View Source
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

func (*BaseFormatter) Reset

func (f *BaseFormatter) Reset()

Reset after format

func (*BaseFormatter) SetOutput

func (f *BaseFormatter) SetOutput(out io.Writer)

SetOutput writer

type ByteStringWriter

type ByteStringWriter interface {
	io.Writer
	io.ByteWriter
	io.StringWriter
	fmt.Stringer
}

ByteStringWriter interface

type DataFormatter

type DataFormatter interface {
	Format() string
	FormatTo(w io.Writer)
}

DataFormatter interface

type Float added in v0.6.0

type Float interface {
	~float32 | ~float64
}

Float interface type

type Int added in v0.6.0

type Int interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

Int interface type

type IntOrFloat added in v0.6.0

type IntOrFloat interface {
	Int | Float
}

IntOrFloat interface type. all int and float types

type MarshalFunc

type MarshalFunc func(v any) ([]byte, error)

MarshalFunc define

type ScalarType added in v0.6.0

type ScalarType interface {
	Int | Uint | Float | ~string | ~bool
}

ScalarType interface type.

contains: (x)int, float, ~string, ~bool types

type StringWriteStringer

type StringWriteStringer interface {
	io.StringWriter
	fmt.Stringer
}

StringWriteStringer interface

type Uint added in v0.6.0

type Uint interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Uint interface type

type UnmarshalFunc

type UnmarshalFunc func(bts []byte, ptr any) error

UnmarshalFunc define

type Xint added in v0.6.0

type Xint interface {
	// equal: ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint32 | ~uint64
	Int | Uint
}

Xint interface type. all int or uint types

type XintOrFloat added in v0.6.0

type XintOrFloat interface {
	Int | Uint | Float
}

XintOrFloat interface type. all (x)int and float types

Jump to

Keyboard shortcuts

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