Documentation
¶
Index ¶
- Variables
- func GetClientIP(ctx context.Context) string
- func GetContext(ctx context.Context, setHeader func(header *transport.Header)) context.Context
- func GetHeader(ctx context.Context, key string) string
- func GetIdentityInfo(ctx context.Context) *pb.IdentityInfo
- func GetIntOrgID(ctx context.Context) (int64, error)
- func GetIntUserID(ctx context.Context) (int64, error)
- func GetInternalClient(ctx context.Context) string
- func GetLang(ctx context.Context) string
- func GetOrg(ctx context.Context) string
- func GetOrgID(ctx context.Context) string
- func GetUserID(ctx context.Context) string
- func HTTPLanguage(r *http.Request) i18n.LanguageCodes
- func IsInternalClient(ctx context.Context) bool
- func Language(ctx context.Context) i18n.LanguageCodes
- func Options() transport.ServiceOption
- func WithCustomHeaderContext(ctx context.Context, header transport.Header) context.Context
- func WithCustomHeaderKVContext(ctx context.Context, kvs ...string) context.Context
- func WithInternalClientContext(ctx context.Context, internalClient string) context.Context
- func WithOrgIDContext(ctx context.Context, orgID string) context.Context
- func WithUserIDContext(ctx context.Context, userID string) context.Context
- type Error
- type Response
- type ValidationError
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var I18n i18n.I18n
I18n .
Functions ¶
func GetContext ¶
func GetIdentityInfo ¶
func GetIdentityInfo(ctx context.Context) *pb.IdentityInfo
GetIdentityInfo get User-ID, Internal-Client and Org-ID from header. return nil if no identity info found.
func GetInternalClient ¶
func IsInternalClient ¶
func WithCustomHeaderContext ¶
func WithInternalClientContext ¶
WithInternalClientContext .
Types ¶
type Error ¶
type Error struct {
Code interface{} `json:"code,omitempty"`
Msg interface{} `json:"msg,omitempty"`
Ctx interface{} `json:"ctx,omitempty"`
}
Error .
type Response ¶
type Response struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
UserIDs []string `json:"userIDs,omitempty"`
Err *Error `json:"err,omitempty"`
}
Response .
type ValidationError ¶
type Validator ¶
type Validator interface {
Validate() error
}
Define validator and error interface as all related struct in protoc-gen-validate are defined as text templates. i.e. https://github.com/envoyproxy/protoc-gen-validate/blob/main/templates/go/message.go
Click to show internal directories.
Click to hide internal directories.