types

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK      = 0
	SUCCESS = "success"

	InvalidParams = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyStruct

type EmptyStruct struct{}

func NewEmptyStruct

func NewEmptyStruct() EmptyStruct

type NullBool

type NullBool struct {
	sql.NullBool
}

NullBool is an alias for sql.NullBool data type.

func NewBool

func NewBool(v bool) NullBool

func NewBoolNull

func NewBoolNull() NullBool

func (*NullBool) Empty

func (nb *NullBool) Empty() bool

Empty 判断为nil或false.

func (*NullBool) Equal

func (nb *NullBool) Equal(v NullBool) bool

Equal 比较是否相等.

func (*NullBool) GetValue

func (nb *NullBool) GetValue() bool

GetValue 获取值.

func (*NullBool) IsNull added in v1.1.5

func (nb *NullBool) IsNull() bool

IsNull 是否是Nil.

func (NullBool) MarshalJSON

func (nb NullBool) MarshalJSON() ([]byte, error)

MarshalJSON for NullBool.

func (NullBool) String

func (nb NullBool) String() string

func (*NullBool) UnmarshalJSON

func (nb *NullBool) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullBool.

type NullFloat64

type NullFloat64 struct {
	sql.NullFloat64
}

NullFloat64 is an alias for sql.NullFloat64 data type.

func NewFloat64

func NewFloat64(v float64) NullFloat64

func NewFloat64Null

func NewFloat64Null() NullFloat64

func (NullFloat64) Empty

func (nf NullFloat64) Empty() bool

Empty 判断为nil或0.

func (*NullFloat64) Equal

func (nf *NullFloat64) Equal(v NullFloat64) bool

Equal 比较是否相等.

func (*NullFloat64) GetValue

func (nf *NullFloat64) GetValue() float64

GetValue 获取值.

func (*NullFloat64) IsNull added in v1.1.5

func (nf *NullFloat64) IsNull() bool

IsNull 是否是Nil.

func (NullFloat64) MarshalJSON

func (nf NullFloat64) MarshalJSON() ([]byte, error)

MarshalJSON for NullFloat64.

func (NullFloat64) String

func (nf NullFloat64) String() string

func (*NullFloat64) UnmarshalJSON

func (nf *NullFloat64) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullFloat64.

type NullInt

type NullInt struct {
	sql.NullInt64
}

NullInt is an alias for sql.NullInt64 data type.

func NewInt

func NewInt(v int) NullInt

func NewIntNull

func NewIntNull() NullInt

func (*NullInt) Empty

func (ni *NullInt) Empty() bool

Empty 判断为nil或0.

func (*NullInt) Equal

func (ni *NullInt) Equal(v NullInt) bool

Equal 比较是否相等.

func (*NullInt) GetValue

func (ni *NullInt) GetValue() int

GetValue 获取值.

func (*NullInt) IsNull added in v1.1.5

func (ni *NullInt) IsNull() bool

IsNull 是否是Nil.

func (NullInt) MarshalJSON

func (ni NullInt) MarshalJSON() ([]byte, error)

MarshalJSON for NullInt.

func (NullInt) String

func (ni NullInt) String() string

func (*NullInt) UnmarshalJSON

func (ni *NullInt) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullInt.

type NullInt32 added in v1.4.1

type NullInt32 struct {
	sql.NullInt32
}

NullInt32 is an alias for sql.NullInt64 data type.

func NewInt32 added in v1.4.1

func NewInt32(v int32) NullInt32

func NewInt32Null added in v1.4.1

func NewInt32Null() NullInt32

func (*NullInt32) Empty added in v1.4.1

func (ni *NullInt32) Empty() bool

Empty 判断为nil或0.

func (*NullInt32) Equal added in v1.4.1

func (ni *NullInt32) Equal(v NullInt32) bool

Equal 比较是否相等.

func (*NullInt32) GetValue added in v1.4.1

func (ni *NullInt32) GetValue() int32

GetValue 获取值.

func (*NullInt32) IsNull added in v1.4.1

func (ni *NullInt32) IsNull() bool

IsNull 是否是Nil.

func (NullInt32) MarshalJSON added in v1.4.1

func (ni NullInt32) MarshalJSON() ([]byte, error)

MarshalJSON for NullInt.

func (NullInt32) String added in v1.4.1

func (ni NullInt32) String() string

func (*NullInt32) UnmarshalJSON added in v1.4.1

func (ni *NullInt32) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullInt.

type NullInt64

type NullInt64 struct {
	sql.NullInt64
}

NullInt64 is an alias for sql.NullInt64 data type.

func NewInt64

func NewInt64(v int64) NullInt64

func NewInt64Null

func NewInt64Null() NullInt64

func (*NullInt64) Equal

func (ni *NullInt64) Equal(v NullInt64) bool

Equal 比较是否相等.

func (*NullInt64) GetValue

func (ni *NullInt64) GetValue() int64

GetValue 获取值.

func (*NullInt64) IsEmpty added in v1.4.1

func (ni *NullInt64) IsEmpty() bool

IsEmpty 判断为nil或0.

func (*NullInt64) IsNull added in v1.1.5

func (ni *NullInt64) IsNull() bool

IsNull 是否是Nil.

func (NullInt64) MarshalJSON

func (ni NullInt64) MarshalJSON() ([]byte, error)

MarshalJSON for NullInt64.

func (*NullInt64) String

func (ni *NullInt64) String() string

func (*NullInt64) UnmarshalJSON

func (ni *NullInt64) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullInt64.

type NullString

type NullString struct {
	sql.NullString
}

NullString is an alias for sql.NullString data type.

func NewEmptyStr

func NewEmptyStr() NullString

func NewStr

func NewStr(str string) NullString

func NewStrNull

func NewStrNull() NullString

func (NullString) Empty

func (ns NullString) Empty() bool

Empty 判断为nil或"".

func (*NullString) Equal

func (ns *NullString) Equal(v NullString) bool

Equal 比较是否相等.

func (*NullString) GetValue

func (ns *NullString) GetValue() string

GetValue 获取值.

func (*NullString) IsNull added in v1.1.5

func (ns *NullString) IsNull() bool

IsNull 是否是Nil.

func (NullString) MarshalJSON

func (ns NullString) MarshalJSON() ([]byte, error)

MarshalJSON for NullString.

func (NullString) String

func (ns NullString) String() string

func (*NullString) UnmarshalJSON

func (ns *NullString) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullString.

type NullTime

type NullTime struct {
	sql.NullTime
}

NullTime is an alias for mysql.NullTime data type.

func NewTime

func NewTime(t time.Time) NullTime

func NewTimeNull

func NewTimeNull() NullTime

func (NullTime) Empty

func (nt NullTime) Empty() bool

Empty 判断为nil或0.

func (*NullTime) Equal

func (nt *NullTime) Equal(v NullTime) bool

Equal 比较是否相等.

func (*NullTime) GetValue

func (nt *NullTime) GetValue() time.Time

GetValue 获取值.

func (*NullTime) IsNull added in v1.1.5

func (nt *NullTime) IsNull() bool

IsNull 是否是Nil.

func (NullTime) MarshalJSON

func (nt NullTime) MarshalJSON() ([]byte, error)

MarshalJSON for NullTime.

func (NullTime) String

func (nt NullTime) String() string

func (*NullTime) TimeStamp added in v1.1.5

func (nt *NullTime) TimeStamp() int64

TimeStamp 获取时间戳, 单位: s.

func (*NullTime) UnmarshalJSON

func (nt *NullTime) UnmarshalJSON(b []byte) error

UnmarshalJSON for NullTime.

type Pageable

type Pageable struct {
	//TotalCount 总数量
	TotalCount int64 `json:"totalCount"`

	//TotalPage 总页数
	TotalPage int `json:"totalPage"`

	//Page 当前页数
	Page int `json:"page"`

	//PageSize 每页数量
	PageSize int `json:"pageSize"`

	//Rows 记录
	Rows interface{} `json:"rows"`

	//HasNext 是否还有下一页
	HasNext bool `json:"hasNext"`
}

func NewPageable

func NewPageable(rows interface{}, page int, pageSize int, totalCount int64) *Pageable

func (Pageable) String

func (p Pageable) String() string

type RespOpt

type RespOpt func(response *Response)

func RespWithCookies

func RespWithCookies(cookies ...*http.Cookie) RespOpt

RespWithCookies 设置Cookie.

func RespWithHeader

func RespWithHeader(key, value string) RespOpt

RespWithHeader 添加header.

func RespWithHeaders

func RespWithHeaders(header map[string]string) RespOpt

RespWithHeaders 添加多个header.

func RespWithStatus

func RespWithStatus(statusCode int) RespOpt

RespWithStatus 设置状态码.

type Response

type Response struct {
	Cookie     []*http.Cookie
	Header     map[string]string
	Result     interface{}
	StatusCode int
}

func NewCustomResp

func NewCustomResp(statusCode int, code int, message string, data interface{}) *Response

NewCustomResp 自定义返回, 配合 CustomResponse 使用.

func NewResp

func NewResp(result Result, args ...RespOpt) *Response

func (*Response) AddCookie

func (r *Response) AddCookie(cookies ...*http.Cookie) *Response

AddCookie 添加Cookie.

func (*Response) AddHeader

func (r *Response) AddHeader(key, value string) *Response

AddHeader 添加请求头, 如果值为"", 则被视为删除该头部.

func (*Response) AddHeaders

func (r *Response) AddHeaders(headers map[string]string) *Response

AddHeaders 添加请求头.

func (*Response) SetStatusCode

func (r *Response) SetStatusCode(statusCode int) *Response

SetStatusCode 设置状态码.

type Result

type Result struct {
	//Code 业务状态码
	Code int `json:"code" example:"0" swaggertype:"integer"`

	//Message 信息
	Message string `json:"message" example:"Success" swaggertype:"string"`

	//Data 数据
	Data interface{} `json:"data"`
}

func NewErrResp

func NewErrResp(code int, message string) Result

func NewPageResult

func NewPageResult(page int, pageSize int, totalCount int64, rows interface{}, args ...ResultOpt) Result

func NewResult

func NewResult(data interface{}, args ...ResultOpt) Result

func (Result) String

func (r Result) String() string

type ResultOpt

type ResultOpt func(response *Result)

func ResultWithCode

func ResultWithCode(code int) ResultOpt

func ResultWithMessage

func ResultWithMessage(msg string) ResultOpt

type Set added in v1.1.9

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

Set 非线程安全Set.

func NewFloat32Set added in v1.4.1

func NewFloat32Set(vs ...float32) *Set

func NewFloat64Set added in v1.4.1

func NewFloat64Set(vs ...float64) *Set

func NewInt32Set added in v1.4.1

func NewInt32Set(vs ...int32) *Set

func NewInt64Set added in v1.4.1

func NewInt64Set(vs ...int64) *Set

func NewIntSet added in v1.4.1

func NewIntSet(vs ...int) *Set

func NewSimpleSet

func NewSimpleSet() *Set

func NewStrSet added in v1.4.1

func NewStrSet(vs ...string) *Set

func (*Set) Add added in v1.1.9

func (set *Set) Add(v interface{})

Add 添加元素.

func (*Set) Common added in v1.1.9

func (set *Set) Common(s *Set) *Set

Common 交集.

func (*Set) Copy added in v1.1.9

func (set *Set) Copy() *Set

Copy copy自身.

func (*Set) Del added in v1.1.9

func (set *Set) Del(v interface{})

Del 删除元素.

func (*Set) Diff added in v1.1.9

func (set *Set) Diff(s *Set) *Set

Diff 差集.

func (*Set) Float64Values added in v1.1.9

func (set *Set) Float64Values() ([]float64, error)

Float64Values 获取所有的值.

func (*Set) Has added in v1.1.9

func (set *Set) Has(v interface{}) bool

Has 是否已包含.

func (*Set) Int32Values added in v1.1.9

func (set *Set) Int32Values() ([]int32, error)

Int32Values 获取所有的值.

func (*Set) Int64Values added in v1.1.9

func (set *Set) Int64Values() ([]int64, error)

Int64Values 获取所有的值.

func (*Set) IntValues added in v1.1.9

func (set *Set) IntValues() ([]int, error)

IntValues 获取所有的值.

func (*Set) IsEmpty added in v1.1.9

func (set *Set) IsEmpty() bool

IsEmpty 判断集合是否为空.

func (*Set) IsNotEmpty added in v1.1.9

func (set *Set) IsNotEmpty() bool

IsNotEmpty 判断集合不为空.

func (*Set) MustFloat64Values added in v1.3.5

func (set *Set) MustFloat64Values() []float64

MustFloat64Values 获取所有的值.

func (*Set) MustInt32Values added in v1.3.5

func (set *Set) MustInt32Values() []int32

MustInt32Values 获取所有的值.

func (*Set) MustInt64Values added in v1.3.5

func (set *Set) MustInt64Values() []int64

MustInt64Values 获取所有的值.

func (*Set) MustIntValues added in v1.3.5

func (set *Set) MustIntValues() []int

MustIntValues 获取所有的值.

func (*Set) MustStrValues added in v1.3.5

func (set *Set) MustStrValues() []string

MustStrValues 获取所有的值.

func (*Set) NotHas added in v1.1.9

func (set *Set) NotHas(v interface{}) bool

NotHas 是否不包含.

func (*Set) Size added in v1.1.9

func (set *Set) Size() int

Size 获取长度.

func (*Set) StrValues added in v1.1.9

func (set *Set) StrValues() ([]string, error)

StrValues 获取所有的值.

func (*Set) String added in v1.1.9

func (set *Set) String() string

func (*Set) Union added in v1.1.9

func (set *Set) Union(s *Set) *Set

Union 并集.

func (*Set) Update added in v1.1.9

func (set *Set) Update(vs ...interface{})

Update 批量添加元素.

func (*Set) UpdateFloat32s added in v1.3.5

func (set *Set) UpdateFloat32s(vs ...float32)

UpdateFloat32s 批量添加元素.

func (*Set) UpdateFloat64s added in v1.3.5

func (set *Set) UpdateFloat64s(vs ...float64)

UpdateFloat64s 批量添加元素.

func (*Set) UpdateInt32s added in v1.3.5

func (set *Set) UpdateInt32s(vs ...int32)

UpdateInt32s 批量添加元素.

func (*Set) UpdateInt64s added in v1.3.5

func (set *Set) UpdateInt64s(vs ...int64)

UpdateInt64s 批量添加元素.

func (*Set) UpdateInts added in v1.3.5

func (set *Set) UpdateInts(vs ...int)

UpdateInts 批量添加元素.

func (*Set) UpdateStrings added in v1.3.5

func (set *Set) UpdateStrings(vs ...string)

UpdateStrings 批量添加元素.

func (*Set) Values added in v1.1.9

func (set *Set) Values() []interface{}

Values 获取所有的值.

Jump to

Keyboard shortcuts

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