dtype

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_map_slice_proto protoreflect.FileDescriptor

Functions

func BoolPtr

func BoolPtr(b bool) *bool

func Copy

func Copy(fromValue, toValue interface{})

Copy copy things

func CopyTo added in v0.7.0

func CopyTo[T any](fromValue any) T

func CopyToPtr added in v0.7.0

func CopyToPtr[T any](fromValue any) *T

func DeepFieldProcess added in v0.9.0

func DeepFieldProcess(p interface{}, fc func(input reflect.Value, fieldType reflect.StructField) error) error

func DeepFieldTypes

func DeepFieldTypes(p interface{}) []reflect.StructField

func GetTotalPages

func GetTotalPages(total int64, perPage int) int

func NewPtr added in v0.8.0

func NewPtr[T any]() *T

func TimePtr

func TimePtr(t time.Time) *time.Time

Types

type Buffer added in v0.9.0

type Buffer struct {
	// contains filtered or unexported fields
}

func NewBuffer added in v0.9.0

func NewBuffer() *Buffer

func (*Buffer) AppendBool added in v0.9.0

func (b *Buffer) AppendBool(v bool)

AppendBool appends a bool to the underlying buffer.

func (*Buffer) AppendByte added in v0.9.0

func (b *Buffer) AppendByte(v byte)

AppendByte writes a single byte to the Buffer.

func (*Buffer) AppendFloat added in v0.9.0

func (b *Buffer) AppendFloat(f float64, bitSize int)

AppendFloat appends a float to the underlying buffer. It doesn't quote NaN or +/- Inf.

func (*Buffer) AppendInt added in v0.9.0

func (b *Buffer) AppendInt(i int64)

AppendInt appends an integer to the underlying buffer (assuming base 10).

func (*Buffer) AppendString added in v0.9.0

func (b *Buffer) AppendString(s string)

AppendString writes a string to the Buffer.

func (*Buffer) AppendUint added in v0.9.0

func (b *Buffer) AppendUint(i uint64)

AppendUint appends an unsigned integer to the underlying buffer (assuming base 10).

func (*Buffer) Bytes added in v0.9.0

func (b *Buffer) Bytes() []byte

Bytes returns a mutable reference to the underlying byte slice.

func (*Buffer) Cap added in v0.9.0

func (b *Buffer) Cap() int

Cap returns the capacity of the underlying byte slice.

func (*Buffer) Len added in v0.9.0

func (b *Buffer) Len() int

Len returns the length of the underlying byte slice.

func (*Buffer) Reset added in v0.9.0

func (b *Buffer) Reset()

Reset resets the underlying byte slice. Subsequent writes re-use the slice's backing array.

func (*Buffer) String added in v0.9.0

func (b *Buffer) String() string

String returns a string copy of the underlying byte slice.

func (*Buffer) Write added in v0.9.0

func (b *Buffer) Write(bs []byte) (int, error)

Write implements io.Writer.

type H

type H = map[string]interface{}

type MapStringSlicePb

type MapStringSlicePb struct {
	MapValue map[string]*StringSlicePb `` /* 173-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*MapStringSlicePb) Descriptor deprecated

func (*MapStringSlicePb) Descriptor() ([]byte, []int)

Deprecated: Use MapStringSlicePb.ProtoReflect.Descriptor instead.

func (*MapStringSlicePb) GetMapValue

func (x *MapStringSlicePb) GetMapValue() map[string]*StringSlicePb

func (*MapStringSlicePb) ProtoMessage

func (*MapStringSlicePb) ProtoMessage()

func (*MapStringSlicePb) ProtoReflect

func (x *MapStringSlicePb) ProtoReflect() protoreflect.Message

func (*MapStringSlicePb) Reset

func (x *MapStringSlicePb) Reset()

func (*MapStringSlicePb) Scan

func (m *MapStringSlicePb) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*MapStringSlicePb) String

func (x *MapStringSlicePb) String() string

type MultiInputs

type MultiInputs struct {
	// contains filtered or unexported fields
}

func MakeMultiInputs added in v0.7.0

func MakeMultiInputs(args ...interface{}) *MultiInputs

func (*MultiInputs) Add

func (mi *MultiInputs) Add(input interface{})

func (*MultiInputs) Bind added in v0.7.0

func (mi *MultiInputs) Bind(in interface{}) interface{}

type Number

type Number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

type PageParams

type PageParams struct {
	PerPage int `query:"per_page"`
	PageNum int `query:"page_number"`
}

func (*PageParams) SetDefault added in v0.7.0

func (p *PageParams) SetDefault(defaultPerPage int)

func (*PageParams) Valid added in v0.7.0

func (p *PageParams) Valid() bool

type PageResult

type PageResult struct {
	PerPage    int
	PageNum    int
	Total      int64
	TotalPages int
}

func NewPageResult

func NewPageResult(perPage, pageNum int, total int64) PageResult

NewPageResult 根据输入生成page,一般由于数据库操作时用了offset等操作,total和len(data)不一致 perPage: 每页数量 pageNum: 当前页 total: 总数

func (PageResult) Json

func (p PageResult) Json(key string, data interface{}) map[string]interface{}

type Pool added in v0.9.0

type Pool[T PoolElement] struct {
	// contains filtered or unexported fields
}

func NewPool added in v0.9.0

func NewPool[T PoolElement](newFunc func() T) Pool[T]

NewPool make a new pool

func (Pool[T]) Free added in v0.9.0

func (p Pool[T]) Free(el T)

func (Pool[T]) Get added in v0.9.0

func (p Pool[T]) Get() T

Get retrieves a Buffer from the pool, creating one if necessary.

type PoolElement added in v0.9.0

type PoolElement interface {
	Reset()
}

type StringSliceMap

type StringSliceMap map[string][]string

func (StringSliceMap) HaveIntersection

func (n StringSliceMap) HaveIntersection(key string, input StringSliceMap) bool

func (*StringSliceMap) Scan

func (n *StringSliceMap) Scan(value interface{}) error

Scan implements the Scanner interface.

func (StringSliceMap) Value

func (n StringSliceMap) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type StringSlicePb

type StringSlicePb struct {
	Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*StringSlicePb) Descriptor deprecated

func (*StringSlicePb) Descriptor() ([]byte, []int)

Deprecated: Use StringSlicePb.ProtoReflect.Descriptor instead.

func (*StringSlicePb) GetValue

func (x *StringSlicePb) GetValue() []string

func (*StringSlicePb) ProtoMessage

func (*StringSlicePb) ProtoMessage()

func (*StringSlicePb) ProtoReflect

func (x *StringSlicePb) ProtoReflect() protoreflect.Message

func (*StringSlicePb) Reset

func (x *StringSlicePb) Reset()

func (*StringSlicePb) String

func (x *StringSlicePb) String() string

type Time

type Time timestamp.Timestamp

func FromStdTime

func FromStdTime(t time.Time) Time

func Now

func Now() Time

func NowPtr

func NowPtr() *Time

func (*Time) AsTime

func (n *Time) AsTime() time.Time

func (*Time) Marshal

func (n *Time) Marshal() ([]byte, error)

func (Time) MarshalJSON

func (n Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

func (n *Time) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Time) Unmarshal

func (n *Time) Unmarshal(data []byte) error

func (*Time) UnmarshalJSON

func (n *Time) UnmarshalJSON(b []byte) error

func (Time) Value

func (n Time) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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