xjtypes

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt64

func BytesToInt64(buf []byte) int64

func CollectFloat64 added in v0.7.4

func CollectFloat64(list interface{}, field string) []float64

func CollectInt added in v0.7.4

func CollectInt(list interface{}, field string) []int

func CollectInt64 added in v0.7.4

func CollectInt64(list interface{}, field string) []int64

func CollectSetFloat64 added in v0.7.4

func CollectSetFloat64(list interface{}, field string) []float64

func CollectSetInt added in v0.7.4

func CollectSetInt(list interface{}, field string) []int

func CollectSetInt64 added in v0.7.4

func CollectSetInt64(list interface{}, field string) []int64

func CollectSetString added in v0.7.4

func CollectSetString(list interface{}, field string) []string

func CollectString added in v0.7.4

func CollectString(list interface{}, field string) []string

func ContainsInt added in v0.1.9

func ContainsInt(list []int, val int) bool

func ContainsInt64 added in v0.1.9

func ContainsInt64(list []int64, val int64) bool

func ContainsStr added in v0.1.9

func ContainsStr(list []string, str string) bool

Contains checks if str is in list.

func ContainsUint added in v0.7.4

func ContainsUint(list []uint, val uint) bool

func Int64ToBytes

func Int64ToBytes(i int64) []byte

func IsDigit added in v0.7.4

func IsDigit(str string) bool

是否数字

func IsEmail added in v0.7.4

func IsEmail(str string) bool

是否电子邮箱地址

func SelectSortInt added in v0.7.4

func SelectSortInt(arr []int) []int

func SelectSortSring added in v0.7.4

func SelectSortSring(arr []string) []string

Types

type App

type App struct {
	Name    string
	Url     string
	Port    int
	Rpcport int
}

服务的名称等

type Auth

type Auth struct {
	AccessSecret string
	AccessExpire int
}

jwt验证的密钥和有效时间

type Config

type Config struct {
	Url  string
	Port int
}

如果配置使用本地配置文件, 这个可以不要

type Datasource

type Datasource struct {
	Drivername string
	Dsn        string
}

数据源

type Decimal2 added in v0.8.0

type Decimal2 float64

func (Decimal2) MarshalJSON added in v0.8.0

func (t Decimal2) MarshalJSON() ([]byte, error)

func (*Decimal2) UnmarshalJSON added in v0.8.0

func (t *Decimal2) UnmarshalJSON(data []byte) (err error)

type ElasticSearch

type ElasticSearch struct {
	Addr     string
	Username string
	Password string
}

es搜索

type EsDate

type EsDate time.Time

func (EsDate) MarshalJSON

func (t EsDate) MarshalJSON() ([]byte, error)

func (*EsDate) UnmarshalJSON

func (t *EsDate) UnmarshalJSON(data []byte) (err error)

type EsTime

type EsTime time.Time

func (EsTime) MarshalJSON

func (t EsTime) MarshalJSON() ([]byte, error)

func (*EsTime) UnmarshalJSON

func (t *EsTime) UnmarshalJSON(data []byte) (err error)

type Etcd

type Etcd struct {
	Addrs     []string
	LeaseTime int
}

http和rpc服务的注册管理

type Gateway

type Gateway struct {
	Url  string
	Port int
}

如果服务间的调用都通过rpc,这个可以不要

type GormWrapper added in v0.7.4

type GormWrapper struct {
	Where   string
	Args    []interface{}
	Cols    string
	Orderby string
	Current int
	Size    int
	Sets    map[string]interface{}
	Debug   bool
}

func (*GormWrapper) Eq added in v0.7.4

func (this *GormWrapper) Eq(field string, val interface{}) *GormWrapper

EQ 就是 EQUAL等于

func (*GormWrapper) Ge added in v0.7.4

func (this *GormWrapper) Ge(field string, val interface{}) *GormWrapper

GREATER THAN OR EQUAL 大于等于

func (*GormWrapper) Gt added in v0.7.4

func (this *GormWrapper) Gt(field string, val interface{}) *GormWrapper

GREATER THAN大于

func (*GormWrapper) In added in v0.7.4

func (this *GormWrapper) In(field string, val interface{}) *GormWrapper

func (*GormWrapper) InSql added in v0.7.4

func (this *GormWrapper) InSql(field string, val string) *GormWrapper

func (*GormWrapper) Le added in v0.7.4

func (this *GormWrapper) Le(field string, val interface{}) *GormWrapper

LE 就是 LESS THAN OR EQUAL 小于等于

func (*GormWrapper) Like added in v0.7.4

func (this *GormWrapper) Like(field string, val interface{}) *GormWrapper

func (*GormWrapper) Lt added in v0.7.4

func (this *GormWrapper) Lt(field string, val interface{}) *GormWrapper

LT 就是 LESS THAN小于

func (*GormWrapper) Ne added in v0.7.4

func (this *GormWrapper) Ne(field string, val interface{}) *GormWrapper

NE 就是 NOT EQUAL不等于

func (*GormWrapper) OrderByDesc added in v0.7.4

func (this *GormWrapper) OrderByDesc(field string)

func (*GormWrapper) Set added in v0.7.4

func (this *GormWrapper) Set(field string, val interface{}) *GormWrapper

func (*GormWrapper) SetDb added in v0.7.4

func (this *GormWrapper) SetDb(db *gorm.DB) *gorm.DB

type Json

type Json string

func (Json) MarshalJSON

func (j Json) MarshalJSON() ([]byte, error)

func (*Json) UnmarshalJSON

func (j *Json) UnmarshalJSON(data []byte) (err error)

type Nsq

type Nsq struct {
	Nsqds       []string
	Nsqlookupds []string
}

NSQ消息

type Page

type Page struct {
	Current int         `json:"current""` //当前页
	Size    int         `json:"size"`     //每页条数
	Total   int64       `json:"total"`    //总条数
	Pages   int64       `json:"pages"`    //总页数
	Records interface{} `json:"records"`  //结果集
}

func (*Page) MakePage

func (p *Page) MakePage(records interface{}, current, size int, total int64) Page

func (*Page) SetPageSize

func (p *Page) SetPageSize(current, size int, total int64)

func (*Page) SetTotal

func (p *Page) SetTotal(total int64)

type QueryWrapper

type QueryWrapper struct {
	Where   string
	Args    []interface{}
	Cols    string
	Orderby string
	Current int
	Size    int
}

func (QueryWrapper) Set

func (this QueryWrapper) Set(db *gorm.DB) *gorm.DB

type R

type R struct {
	Code      int         `json:"code"`
	Timestamp int64       `json:"timestamp"`
	Msg       string      `json:"msg"`
	Data      interface{} `json:"data"`
}

func (*R) Fail

func (r *R) Fail(msg string) R

func (*R) Make

func (r *R) Make(code int, data interface{}, msg string) R

func (*R) Success

func (r *R) Success(data interface{}) R

type Redis

type Redis struct {
	Addr     string
	Password string
	Db       int
}

缓存

type Register

type Register struct {
	Url  string
	Port int
}

如果服务都注册到ETCD,这个可以不要

type XjDate

type XjDate time.Time

func (*XjDate) GobDecode added in v0.1.2

func (t *XjDate) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (XjDate) GobEncode added in v0.1.2

func (t XjDate) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (XjDate) MarshalJSON

func (t XjDate) MarshalJSON() ([]byte, error)

func (*XjDate) Scan

func (t *XjDate) Scan(v interface{}) error

func (XjDate) String

func (t XjDate) String() string

func (XjDate) StringDiy

func (t XjDate) StringDiy(sFormat string) string

func (*XjDate) UnmarshalJSON

func (t *XjDate) UnmarshalJSON(data []byte) (err error)

func (XjDate) Value

func (t XjDate) Value() (driver.Value, error)

type XjTime

type XjTime time.Time

func (*XjTime) GobDecode added in v0.1.2

func (t *XjTime) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (XjTime) GobEncode added in v0.1.2

func (t XjTime) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (XjTime) MarshalJSON

func (t XjTime) MarshalJSON() ([]byte, error)

func (*XjTime) Scan

func (t *XjTime) Scan(v interface{}) error

func (XjTime) String

func (t XjTime) String() string

func (XjTime) StringDiy

func (t XjTime) StringDiy(sFormat string) string

func (*XjTime) UnmarshalJSON

func (t *XjTime) UnmarshalJSON(data []byte) (err error)

func (XjTime) Value

func (t XjTime) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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