Versions in this module Expand all Collapse all v1 v1.0.0 Oct 25, 2023 Changes in this version + var AuthAPIMap = map[string]AuthAPI + var AuthAppIdMap = sync.Map + var AuthServiceInterface mysession.Interface + var ContextAppAdmin = "app.session.user.admin" + var ContextAppAdminYes = "admin" + var ContextAppId = "app.id" + var ContextAuthorizationValuePrefix = "bearer" + var ContextFieldList = []ContextFieldRule + var ContextTraceId = "trace.id" + var ContextUserId = "app.session.user.id" + var Debug = false + var Environment = "Development" + var ListeningAddress = ":10000" + var ListeningHTTPGateWay = false + var ListeningHTTPGateWayAddress = ":10001" + var ListeningHTTPProf = false + var ListeningHTTPProfAddress = ":10002" + var LogJson = false + var LogLevel = "debug" + var LogMaxAge = 30 * 24 * time.Hour + var LogName = "log.log" + var LogPath = "./log" + var LogRotationTime = 24 * time.Hour + var NewrelicApplication *newrelic.Application + var NewrelicLicense = "xxx" + var SkipLogInterceptor = true + var UseNewrelic bool + func AuthGRPCInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error) + func ContextFieldInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error) + func ContextGetAppID(ctx context.Context) string + func ContextGetUserId(ctx context.Context) string + func ContextIsAdmin(ctx context.Context) bool + func GetIncomingContext(ctx context.Context, name string) []string + func GetIncomingContextOne(ctx context.Context, name string) string + func GetOutgoingContext(ctx context.Context, name string) []string + func GetOutgoingContextOne(ctx context.Context, name string) string + func Init(config *Config) error + func InitConfig(flagMap map[string]cli.Flag) + func LogInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error) + func SetOutgoingContext(ctx context.Context, kv []string) context.Context + func TraceInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error) + type AuthAPI struct + IsAdmin bool + Name string + NeedToken bool + func NewAuthAPI(name string, needToken bool, isAdmin bool, method interface{}) AuthAPI + type Config struct + AppName string + AppUsage string + LoadDiyFlagConfig func(map[string]cli.Flag) + LoadInitPrepare func() error + UseNewrelic bool + type ContextFieldRule struct + Name string + One bool + Require bool + Through bool + type RPCMicroService struct + GRPCServer *grpc.Server + Name string + func NewRPCMicroService(name string) (*RPCMicroService, error) + func (s *RPCMicroService) Run(vars *RPCMicroServiceRunHooks) error + type RPCMicroServiceRunHooks struct + AopEndFunc func() error + RegisterHTTPGateWayServer func(httpServer *runtime.ServeMux, endpoint string, opts []grpc.DialOption) + RegisterRPCServer func(gRPCServer *grpc.Server) + RegisterRPCServerStreamInterceptor []grpc.StreamServerInterceptor + RegisterRPCServerUnaryInterceptor []grpc.UnaryServerInterceptor + TCPAddress string