Documentation ¶
Index ¶
- Constants
- Variables
- func CloseAllDBConnections()
- func ConnectDB(dbconfig *dbConfig, args ...string) *gorm.DB
- func GetDB(args ...string) *gorm.DB
- func NewDbConfig(engine, host, port, user, pwd, dbname string, args ...int) *dbConfig
- func NewDbConfigFromDSN(engine, dsn string) *dbConfig
- func RegisterApi(r apiInterface)
- func RegisterDBModel(dm dbModel, args ...string)
- func RegisterGroupedApi(groupName string, r apiInterface)
- func RegisterMiddleware(m middlewareInterFace)
- func RunWebServer()
- func SyncDB(args ...string)
- type ApiTemplate
- func (a *ApiTemplate) Bind(obj interface{})
- func (a *ApiTemplate) Delete() Response
- func (a *ApiTemplate) Get() Response
- func (a *ApiTemplate) GetCtx() *gin.Context
- func (a *ApiTemplate) GetLock() string
- func (a *ApiTemplate) GetResource() string
- func (a *ApiTemplate) Head() Response
- func (a *ApiTemplate) Options() Response
- func (a *ApiTemplate) Post() Response
- func (a *ApiTemplate) Put() Response
- type BaseError
- type BaseModel
- type ContextObject
- type DomainModel
- type DomainObject
- type GMap
- type JsonResponse
- type Map
- type RawResponse
- type RequestParams
- type Response
Constants ¶
View Source
const SERVICE_BUSINESS_ERROR_CODE = 520 // 业务错误
View Source
const SERVICE_INNER_SUCCESS_CODE = 200
View Source
const SERVICE_SUCCESS_CODE = 200 // 业务成功
View Source
const SERVICE_SYSTEM_ERROR_CODE = 530 // 系统错误
View Source
const VERSION = "0.0.3"
Variables ¶
View Source
var ( Debug = log.Debugln Debugf = log.Debugf Info = log.Infoln Infof = log.Infof Warn = log.Warningln Warnf = log.Warningf Error = log.Errorln Errorf = log.Errorf Panic = log.Panicln Panicf = log.Panicf )
View Source
var Config *config
Functions ¶
func CloseAllDBConnections ¶
func CloseAllDBConnections()
func NewDbConfig ¶
func NewDbConfigFromDSN ¶
func NewDbConfigFromDSN(engine, dsn string) *dbConfig
func RegisterApi ¶
func RegisterApi(r apiInterface)
func RegisterDBModel ¶
func RegisterDBModel(dm dbModel, args ...string)
func RegisterGroupedApi ¶
func RegisterGroupedApi(groupName string, r apiInterface)
func RegisterMiddleware ¶
func RegisterMiddleware(m middlewareInterFace)
func RunWebServer ¶
func RunWebServer()
Types ¶
type ApiTemplate ¶
type ApiTemplate struct {
// contains filtered or unexported fields
}
func (*ApiTemplate) Delete ¶
func (a *ApiTemplate) Delete() Response
func (*ApiTemplate) Get ¶
func (a *ApiTemplate) Get() Response
func (*ApiTemplate) GetCtx ¶
func (a *ApiTemplate) GetCtx() *gin.Context
func (*ApiTemplate) GetLock ¶
func (a *ApiTemplate) GetLock() string
func (*ApiTemplate) GetResource ¶
func (a *ApiTemplate) GetResource() string
func (*ApiTemplate) Head ¶
func (a *ApiTemplate) Head() Response
func (*ApiTemplate) Options ¶
func (a *ApiTemplate) Options() Response
func (*ApiTemplate) Post ¶
func (a *ApiTemplate) Post() Response
func (*ApiTemplate) Put ¶
func (a *ApiTemplate) Put() Response
type BaseError ¶
func DefaultError ¶
func NewBusinessError ¶
func NewSystemError ¶
func (*BaseError) IsBusinessError ¶
func (*BaseError) IsSystemError ¶
type ContextObject ¶
type ContextObject struct {
// contains filtered or unexported fields
}
func (*ContextObject) GetCtx ¶
func (c *ContextObject) GetCtx() context.Context
func (*ContextObject) SetCtx ¶
func (c *ContextObject) SetCtx(ctx context.Context)
type DomainModel ¶
type DomainModel struct {
DomainObject
}
DomainModel 领域模型(表示实体)
func (*DomainModel) GetDbModel ¶
func (this *DomainModel) GetDbModel() interface{}
func (*DomainModel) NewFromDbModel ¶
func (this *DomainModel) NewFromDbModel(do interface{}, dbModel interface{})
NewFromDbModel 使用反射机制将dbModel中的field值复制到domainObject中
type DomainObject ¶
type DomainObject struct {
ContextObject
}
DomainObject 领域对象(可以表示聚合根、聚合、实体、值对象和领域服务)
type GMap ¶
type GMap map[string]interface{}
func NewEmptyGMap ¶
func NewEmptyGMap() GMap
func NewGMapFromData ¶
type JsonResponse ¶
type JsonResponse struct {
// contains filtered or unexported fields
}
func NewErrorJsonResponse ¶
func NewErrorJsonResponse(errCode string, args ...string) *JsonResponse
func NewJsonResponse ¶
func NewJsonResponse(data interface{}) *JsonResponse
func (*JsonResponse) GetCode ¶
func (this *JsonResponse) GetCode() int
func (*JsonResponse) GetData ¶
func (this *JsonResponse) GetData() interface{}
func (*JsonResponse) GetDataType ¶
func (this *JsonResponse) GetDataType() string
type RawResponse ¶
type RawResponse struct {
// contains filtered or unexported fields
}
func NewErrorRawResponse ¶
func NewErrorRawResponse(msg string) *RawResponse
func NewRawResponse ¶
func NewRawResponse(msg string) *RawResponse
func (*RawResponse) GetCode ¶
func (this *RawResponse) GetCode() int
func (*RawResponse) GetData ¶
func (this *RawResponse) GetData() interface{}
func (*RawResponse) GetDataType ¶
func (this *RawResponse) GetDataType() string
type RequestParams ¶
type RequestParams struct {
GMap
}
func (RequestParams) GetFile ¶
func (rp RequestParams) GetFile(key string) *multipart.FileHeader
func (RequestParams) GetFiles ¶
func (rp RequestParams) GetFiles(key string) []*multipart.FileHeader
Source Files ¶
Click to show internal directories.
Click to hide internal directories.