55
exception/builder.go
Normal file
55
exception/builder.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package exception
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// 12 chars len
|
||||
// :1=status
|
||||
// :3=service
|
||||
// :2=endpoint
|
||||
// :1=common/specific
|
||||
// :5=original
|
||||
|
||||
type Builder struct {
|
||||
Status string
|
||||
Service string
|
||||
Endpoint string
|
||||
Type string
|
||||
Original string
|
||||
}
|
||||
|
||||
func (self *Builder) SetStatus(s string) *Builder {
|
||||
self.Status = s
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Builder) SetService(s string) *Builder {
|
||||
self.Service = s
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Builder) SetEndpoint(s string) *Builder {
|
||||
self.Endpoint = s
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Builder) SetType(s string) *Builder {
|
||||
self.Type = s
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Builder) SetOriginal(s string) *Builder {
|
||||
self.Original = s
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Builder) Build() string {
|
||||
return fmt.Sprintf("%s%s%s%s%s",
|
||||
self.Status,
|
||||
self.Service,
|
||||
self.Endpoint,
|
||||
self.Type,
|
||||
self.Original,
|
||||
)
|
||||
}
|
||||
6
exception/common.go
Normal file
6
exception/common.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package exception
|
||||
|
||||
const (
|
||||
CommonErrorInvalidInput = "00001"
|
||||
CommonErrorUnauthorized = "00002"
|
||||
)
|
||||
32
exception/endpoints.go
Normal file
32
exception/endpoints.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package exception
|
||||
|
||||
// Middleware Service Endpoints
|
||||
const (
|
||||
MiddlewareEndpoint = "01"
|
||||
)
|
||||
|
||||
// Auth Service Endpoints
|
||||
const (
|
||||
AuthRedirectEndpoint = "01"
|
||||
AuthMagicEndpoint = "02"
|
||||
AuthTokenEndpoint = "03"
|
||||
AuthRefreshEndpoint = "04"
|
||||
AuthExchangeEndpoint = "05"
|
||||
)
|
||||
|
||||
// Event Service Endpoints
|
||||
const (
|
||||
EventInfoEndpoint = "01"
|
||||
EventCheckinEndpoint = "02"
|
||||
EventCheckinQueryEndpoint = "03"
|
||||
EventCheckinSubmitEndpoint = "04"
|
||||
)
|
||||
|
||||
// User Service Endpoints
|
||||
const (
|
||||
UserInfoEndpoint = "01"
|
||||
UserUpdateEndpoint = "02"
|
||||
UserListEndpoint = "03"
|
||||
UserFullEndpoint = "04"
|
||||
UserCreateEndpoint = "05"
|
||||
)
|
||||
16
exception/services.go
Normal file
16
exception/services.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package exception
|
||||
|
||||
// Middleware Services
|
||||
const (
|
||||
MiddlewareGinLoggerService = "901"
|
||||
MiddlewareJwtService = "902"
|
||||
MiddlewarePermissionService = "903"
|
||||
MiddlewareApiVersionService = "904"
|
||||
)
|
||||
|
||||
// Application Services
|
||||
const (
|
||||
AuthService = "001"
|
||||
UserService = "002"
|
||||
EventService = "003"
|
||||
)
|
||||
5
exception/specific.go
Normal file
5
exception/specific.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package exception
|
||||
|
||||
const (
|
||||
ApiVersionNotFound = "00001"
|
||||
)
|
||||
8
exception/status.go
Normal file
8
exception/status.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package exception
|
||||
|
||||
const (
|
||||
ErrorStatusSuccess = "2"
|
||||
ErrorStatusUser = "4"
|
||||
ErrorStatusServer = "5"
|
||||
ErrorStatusClient = "6"
|
||||
)
|
||||
6
exception/types.go
Normal file
6
exception/types.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package exception
|
||||
|
||||
const (
|
||||
ErrorTypeCommon = "0"
|
||||
ErrorTypeSpecific = "1"
|
||||
)
|
||||
Reference in New Issue
Block a user