Documentation ¶
Index ¶
- Variables
- func BeegoServeJSON(ctx *context.Context, data interface{})
- func BytesToInt64(buf []byte) int64
- func Camel2Case(name string) string
- func Capitalize(str string) string
- func Case2Camel(name string) string
- func ContainsInt(list []int, item int) bool
- func ContainsInt64(list []int64, item int64) bool
- func ContainsString(list []string, item string) bool
- func CopyStruct(src, dst interface{})
- func Count(db *gorm.DB, sql string) (total int64)
- func DeepFields(ifaceType reflect.Type) []reflect.StructField
- func EtcdGet(endpoints []string, key string) map[string]string
- func EtcdPut(endpoints []string, key, value string) error
- func Float64Round(value float64, scale int) float64
- func Float64ToInt(val float64) int
- func Float64ToInt64(val float64) int64
- func GetBearerToken(ctx *gin.Context) (string, error)
- func GetChineseFirstLetter(chinese string) string
- func GormInit(datasource Datasource) *gorm.DB
- func GormSqlServerInit(Conf NacAppConfig) *gorm.DB
- func Health(c *gin.Context)
- func HttpGetStr(url string) (string, error)
- func HttpGetStrWithToken(url, token string) string
- func HttpGetStrWithTokenInner(url, token string) (string, error)
- func HttpPostStrJson(url, json string) (string, error)
- func HttpPostStrWithToken(url, token string) string
- func HttpPostStrWithTokenJson(url, token, json string) (string, error)
- func Init()
- func Int64ArrayToInterfaceArray(ints []int64) []interface{}
- func Int64ArrayToString(ints []int64) string
- func Int64ToBytes(i int64) []byte
- func IntArrayToString(ints []int) string
- func IntToFloat64(val int) float64
- func InterfaceArrayToInt64Array(src []interface{}) ([]int64, error)
- func InterfaceToBool(val interface{}) bool
- func InterfaceToFloat64(val interface{}) float64
- func InterfaceToInt(val interface{}) int
- func InterfaceToInt64(val interface{}) int64
- func InterfaceToString(val interface{}) string
- func JsonToIntArray(str string) ([]int, error)
- func Lcfirst(str string) string
- func Loadconf()
- func LogDebug(str string)
- func LogError(str string)
- func LogInfo(str string)
- func LogOutput(str, prefix string, calldepin int)
- func LogPrefix(str, prefix string)
- func LogWarn(str string)
- func MapToEntityWithOutType(src map[string]interface{}, dst interface{})
- func MapToEntityWithOutTypeDeep(src map[string]interface{}, dst interface{}) interface{}
- func Md5V(str string) string
- func Md5V2(str string) string
- func Md5V3(str string) string
- func NacosGetService(appConfig AppConfig, serviceName string) (string, error)
- func NacosRegisterService(appConfig AppConfig) (naming_client.INamingClient, error)
- func NacosSelectInstances(appConfig AppConfig, serviceName, prefix string) (string, error)
- func PathVariableFloat32(ctx *gin.Context, key string) (v float32)
- func PathVariableFloat64(ctx *gin.Context, key string) (v float64)
- func PathVariableInt(ctx *gin.Context, key string) (v int)
- func PathVariableInt64(ctx *gin.Context, key string) (v int64)
- func PathVariableString(ctx *gin.Context, key string) (v string)
- func PrintVersion()
- func QueryFloat64(ctx *gin.Context, key string) (v float64)
- func QueryInt(ctx *gin.Context, key string) (v int)
- func QueryInt64(ctx *gin.Context, key string) (v int64)
- func QueryIntDefault(ctx *gin.Context, key string, d int) (v int)
- func QueryMap(ctx *gin.Context) (m map[string]interface{})
- func RedisInit(conf Redis) *redis.Client
- func Refresh(c *gin.Context)
- func Register()
- func RequestBody(ctx *gin.Context, dst interface{})
- func RpcxCall(etcdAddr []string, servicePath, method string, args interface{}) (reply interface{}, err error)
- func RpcxCallByte(etcdAddr []string, servicePath, method string, args interface{}) (reply []byte, err error)
- func RpcxCallStr(etcdAddr []string, servicePath, method string, args interface{}) (reply string, err error)
- func SelectOneHealthyInstance(client naming_client.INamingClient, IpAddr string, Port uint64, ...) (instance string, err error)
- func SpecialChar(src string) string
- func StrToUnix(timeStr, layout string) (int64, error)
- func StringToInt64Array(s string) ([]int64, error)
- func StringToIntArray(s string) ([]int, error)
- func StringToInterfaceArray(s string) ([]interface{}, error)
- func StructCopy(DstStructPtr interface{}, SrcStructPtr interface{})
- func Ucfirst(str string) string
- func UnixToStr(timeUnix int64, layout string) string
- func Utf8ToGbk(s []byte) ([]byte, error)
- type AppConfig
- type Buffer
- type ClientDis
- type Datasource
- type EsDate
- type EsTime
- type Json
- type JsonCamelCase
- type JsonSnakeCase
- type NacAppConfig
- type Redis
- type RegItem
- type ServiceReg
- type Srv
- type StructUtil
- type Val
- type XjDate
- type XjTime
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //Db *xorm.Engine Gorm *gorm.DB Redisdb *redis.Client )
View Source
var ( GitCommit = "7b32838" BuildTime = "2020-05-10 12:29" GoVersion = "1.14" Version = "0.0.1" )
set on build time
View Source
var Config *ini.File
Functions ¶
func BeegoServeJSON ¶
func BytesToInt64 ¶
func Camel2Case ¶
************************************** 其他方法 ************************************** 驼峰式写法转为下划线写法
func ContainsInt ¶
func ContainsInt64 ¶
func ContainsString ¶
func CopyStruct ¶
func CopyStruct(src, dst interface{})
func DeepFields ¶
func DeepFields(ifaceType reflect.Type) []reflect.StructField
func Float64Round ¶
func Float64ToInt ¶
func Float64ToInt64 ¶
func GormInit ¶
func GormInit(datasource Datasource) *gorm.DB
func XormInit(Conf NacAppConfig) *xorm.Engine { dataSourceName := Conf.Datasource.Username + ":" + Conf.Datasource.Password + "@tcp(" + Conf.Datasource.Url + ":" + Conf.Datasource.Port + ")/" + Conf.Datasource.Database + "?charset=utf8&parseTime=True&loc=Asia%2fShanghai" Db, err := xorm.NewEngine(Conf.Datasource.Drivername, dataSourceName) if err = Db.Ping(); err != nil { fmt.Println("数据库连接失败") os.Exit(1) } Db.ShowSQL(true) return Db }
func GormSqlServerInit ¶
func GormSqlServerInit(Conf NacAppConfig) *gorm.DB
func HttpGetStr ¶
func HttpGetStrWithToken ¶
func HttpPostStrJson ¶
func HttpPostStrWithToken ¶
func Int64ArrayToInterfaceArray ¶
func Int64ArrayToInterfaceArray(ints []int64) []interface{}
func Int64ArrayToString ¶
func Int64ToBytes ¶
func IntArrayToString ¶
func IntToFloat64 ¶
func InterfaceToBool ¶
func InterfaceToBool(val interface{}) bool
func InterfaceToFloat64 ¶
func InterfaceToFloat64(val interface{}) float64
func InterfaceToInt ¶
func InterfaceToInt(val interface{}) int
func InterfaceToInt64 ¶
func InterfaceToInt64(val interface{}) int64
func InterfaceToString ¶
func InterfaceToString(val interface{}) string
func JsonToIntArray ¶
func MapToEntityWithOutType ¶
func MapToEntityWithOutType(src map[string]interface{}, dst interface{})
*
- Map转实体类
- @param map 需要初始化的数据,key字段必须与实体类的成员名字一样,否则赋值为空
- @param entity 需要转化成的实体类
- @return
func MapToEntityWithOutTypeDeep ¶
func MapToEntityWithOutTypeDeep(src map[string]interface{}, dst interface{}) interface{}
//Map转实体类(包含子struct)
func NacosGetService ¶
func NacosRegisterService ¶
func NacosRegisterService(appConfig AppConfig) (naming_client.INamingClient, error)
func NacosSelectInstances ¶
func RequestBody ¶
func RpcxCallByte ¶
func RpcxCallStr ¶
func SelectOneHealthyInstance ¶
func SelectOneHealthyInstance(client naming_client.INamingClient, IpAddr string, Port uint64, ServiceName string) (instance string, err error)
func SpecialChar ¶
func StringToInt64Array ¶
func StringToIntArray ¶
func StringToInterfaceArray ¶
func StructCopy ¶
func StructCopy(DstStructPtr interface{}, SrcStructPtr interface{})
Types ¶
type AppConfig ¶
type AppConfig struct { App struct { Name string Url string Port uint64 Rpcport uint64 } Register struct { Url string Port uint64 Kind string NamespaceId string Group string } Config struct { Url string Port uint64 Kind string NamespaceId string Group string DataId string PubDataId string } Gateway struct { Url string Port uint64 } }
func GetAppConfig ¶
type ClientDis ¶
type ClientDis struct {
// contains filtered or unexported fields
}
func NewClientDis ¶
func (*ClientDis) DelServiceList ¶
func (*ClientDis) SerList2Array ¶
func (*ClientDis) SetServiceList ¶
type Datasource ¶
type JsonCamelCase ¶
type JsonCamelCase struct {
Value interface{}
}
************************************** 驼峰json **************************************
func (JsonCamelCase) MarshalJSON ¶
func (c JsonCamelCase) MarshalJSON() ([]byte, error)
type JsonSnakeCase ¶
type JsonSnakeCase struct {
Value interface{}
}
************************************** 下划线json **************************************
func (JsonSnakeCase) MarshalJSON ¶
func (c JsonSnakeCase) MarshalJSON() ([]byte, error)
type NacAppConfig ¶
type NacAppConfig struct { Etcd struct { Url []string LeaseTime int64 } Datasource Datasource Redis Redis }
func GetNacAppConfig ¶
func GetNacAppConfig(appConfig AppConfig, profile string) (string, string, NacAppConfig)
type ServiceReg ¶
type ServiceReg struct {
// contains filtered or unexported fields
}
创建租约注册服务
func NewServiceReg ¶
func NewServiceReg(addr []string, timeNum int64) *ServiceReg
type StructUtil ¶
type StructUtil struct{}
func (StructUtil) CopyStruct2 ¶
func (t StructUtil) CopyStruct2(src, dst interface{})
type XjDate ¶
func InterfaceToDate ¶
func InterfaceToDate(val interface{}) XjDate
func (XjDate) MarshalJSON ¶
func (*XjDate) UnmarshalJSON ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
reflectdemo
|
|
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
routers
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html |
Click to show internal directories.
Click to hide internal directories.