xjtypes

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt64

func BytesToInt64(buf []byte) int64

func Int64ToBytes

func Int64ToBytes(i int64) []byte

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