package comdef

Import Path
	github.com/gookit/goutil/comdef (on go.dev)

Dependency Relation
	imports 6 packages, and imported by 4 packages

Involved Source Files Package comdef provide some common type or constant definitions consts.go consts_nonwin.go errors.go formatter.go interface.go serializer.go symbols.go types.go
Package-Level Type Names (total 42)
/* sort by: | */
Align define align, position: L, C, R, Auto func github.com/gookit/goutil/strutil.Align(s string, length int, align Align) string func github.com/gookit/goutil/strutil.Resize(s string, length int, align Align) string func github.com/gookit/goutil/strutil.Utf8Align(s string, length int, align Align) string func github.com/gookit/goutil/strutil.Utf8Resize(s string, length int, align Align) string const Center const Left const PosAuto const Right const github.com/gookit/goutil/strutil.PosAuto const github.com/gookit/goutil/strutil.PosLeft const github.com/gookit/goutil/strutil.PosMiddle const github.com/gookit/goutil/strutil.PosRight
AnyMap is alias of map[string]any
BaseFormatter struct Usage: type YourFormatter struct { comdef.BaseFormatter } // implement the DataFormatter interface... ClosePrefix string for last "]", "}" Indent string for format each element MaxDepth limit depth for array, map data TODO Out formatted to the writer Prefix string for each element Src data(array, map, struct) for format BsWriter warp the Out, build a ByteStringWriter Reset after format SetOutput writer
ByteStringWriter interface ( ByteStringWriter) String() string ( ByteStringWriter) Write([]byte) (int, error) ( ByteStringWriter) WriteByte(c byte) error ( ByteStringWriter) WriteString(s string) (n int, err error) *github.com/gookit/goutil/byteutil.Buffer *github.com/gookit/goutil/x/stdio.WriteWrapper github.com/apache/thrift/lib/go/thrift.TMemoryBuffer *github.com/libp2p/go-buffer-pool.Buffer *bytes.Buffer *go.uber.org/zap/buffer.Buffer *log/slog/internal/buffer.Buffer *strings.Builder ByteStringWriter : StringWriteStringer ByteStringWriter : github.com/miekg/dns.Writer ByteStringWriter : github.com/quic-go/quic-go/quicvarint.Writer ByteStringWriter : expvar.Var ByteStringWriter : fmt.Stringer ByteStringWriter : gorm.io/gorm/clause.Writer ByteStringWriter : internal/bisect.Writer ByteStringWriter : io.ByteWriter ByteStringWriter : io.StringWriter ByteStringWriter : io.Writer func (*BaseFormatter).BsWriter() ByteStringWriter
Codec interface definition ( Codec) Decode(blob []byte, v any) (err error) ( Codec) Encode(v any) (out []byte, err error)
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
DataFormatter interface ( DataFormatter) Format() string ( DataFormatter) FormatTo(w io.Writer)
Errors multi error list ErrOrNil error Error string First error Errors : error
Float interface type
Float64able interface ( Float64able) Float64() (float64, error) github.com/json-iterator/go.Number *github.com/redis/go-redis/v9.Cmd *github.com/redis/go-redis/v9.StringCmd encoding/json.Number
GoSerializer interface definition ( GoSerializer) Marshal(v any) ([]byte, error) ( GoSerializer) Unmarshal(v []byte, ptr any) error github.com/google/flatbuffers/go.FlatbuffersCodec *github.com/grpc-ecosystem/grpc-gateway/v2/runtime.HTTPBodyMarshaler *github.com/grpc-ecosystem/grpc-gateway/v2/runtime.JSONBuiltin *github.com/grpc-ecosystem/grpc-gateway/v2/runtime.JSONPb github.com/grpc-ecosystem/grpc-gateway/v2/runtime.Marshaler (interface) *github.com/grpc-ecosystem/grpc-gateway/v2/runtime.ProtoMarshaller github.com/json-iterator/go.API (interface) google.golang.org/grpc.Codec (interface) google.golang.org/grpc/encoding.Codec (interface)
Int interface type
Int64able interface ( Int64able) Int64() (int64, error) github.com/json-iterator/go.Number *github.com/redis/go-redis/v9.Cmd *github.com/redis/go-redis/v9.StringCmd encoding/json.Number
IntCheckFunc check func
Integer interface type. all int or uint types
IntOrFloat interface type. all int and float types, but NOT uint types
L2StrMap is alias of map[string]map[string]string
MapFunc definition
MarshalFunc define
Type Parameters: T: any Matcher interface ( Matcher[T]) Match(s T) bool
Type Parameters: T: any MatchFunc definition. implements Matcher interface Match satisfies the Matcher interface
Number interface type. contains all int, uint and float types
NumberOrString interface type for (x)int, float, ~string types
type Position = Align (basic type)
SafeStringFunc safe convert value to string
ScalarType basic interface type. TIP: has bool type, it cannot be ordered contains: (x)int, float, ~string, ~bool types
Serializer interface definition ( Serializer) Deserialize(data []byte, v any) error ( Serializer) Serialize(v any) ([]byte, error)
SimpleType interface type. alias of ScalarType contains: (x)int, float, ~string, ~bool types
SortedType interface type. same of constraints.Ordered it can be ordered, that supports the operators < <= >= >. contains: (x)int, float, ~string types
StrCheckFunc check func
StringHandleFunc definition Handle satisfies the StringHandler interface StringHandleFunc : StringHandler func github.com/gookit/goutil/strutil.OrHandle(s string, fn StringHandleFunc) string
StringHandler interface ( StringHandler) Handle(s string) string StringHandleFunc
StringMatcher interface ( StringMatcher) Match(s string) bool StringMatchFunc *github.com/miekg/dns.NSEC3
StringMatchFunc definition Match satisfies the StringMatcher interface StringMatchFunc : StringMatcher
StringWriteStringer interface ( StringWriteStringer) String() string ( StringWriteStringer) WriteString(s string) (n int, err error) ByteStringWriter (interface) *github.com/gookit/goutil/byteutil.Buffer *github.com/gookit/goutil/x/stdio.WriteWrapper github.com/apache/thrift/lib/go/thrift.TMemoryBuffer *github.com/libp2p/go-buffer-pool.Buffer *bytes.Buffer *go.uber.org/zap/buffer.Buffer *log/slog/internal/buffer.Buffer *strings.Builder StringWriteStringer : expvar.Var StringWriteStringer : fmt.Stringer StringWriteStringer : io.StringWriter
StrMap is alias of map[string]string
ToStringFunc try to convert value to string, return error on fail func github.com/gookit/goutil/internal/comfunc.WithUserConvFn(fn ToStringFunc) comfunc.ConvOptionFn
Type Parameters: T: any ToTypeFunc convert value to defined type
Uint interface type
UnmarshalFunc define
Xint interface type. alias of Integer
XintOrFloat interface type. all int, uint and float types. alias of Number Deprecated: use Number instead.
Package-Level Variables (only one)
ErrConvType error
Package-Level Constants (total 33)
constants for align, position: L, C, R, Auto
ColonChar define
ColonStr define
CommaChar define
CommaStr const define
DefaultSep comma string
constants quote chars
constants quote chars
EqualChar define
EqualStr define
constants for align, position: L, C, R, Auto
Newline string for non-windows
NewlineChar char
NewlineStr string
NoIdx invalid index or length
constants for compare operation
constants for compare operation
constants for compare operation
constants for compare operation
constants for compare operation
constants for compare operation
PathChar define
PathStr define const
constants for align, position: L, C, R, Auto
constants for align, position: L, C, R, Auto
SemicolonChar define
SemicolonStr semicolon define
constants quote chars
constants quote chars
constants quote chars
constants quote chars
SpaceChar char
SpaceStr string