Documentation ¶
Index ¶
- type BasicService
- type BasicServiceImpl
- func (bs *BasicServiceImpl) AfterInject() error
- func (bs *BasicServiceImpl) ServeAbout() string
- func (bs *BasicServiceImpl) ServeCrypto() string
- func (bs *BasicServiceImpl) ServeHome() string
- func (bs *BasicServiceImpl) ServePastebin() string
- func (bs *BasicServiceImpl) ServeStorage() string
- func (bs *BasicServiceImpl) ServeTinyURL() string
- func (bs *BasicServiceImpl) ServeToys() string
- type BlogService
- type BlogServiceImpl
- type CosService
- type CosServiceImpl
- func (cs *CosServiceImpl) AfterInject() error
- func (cs *CosServiceImpl) CosBucketURL(ctx context.Context, req *pb.CosBucketURLReq) (*pb.CosBucketURLResp, error)
- func (cs *CosServiceImpl) CosGet(ctx context.Context, req *pb.CosGetReq) (*pb.CosGetResp, error)
- func (cs *CosServiceImpl) CosPut(ctx context.Context, req *pb.CosPutReq) (*pb.CosPutResp, error)
- func (cs *CosServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, ...) error
- type CryptoService
- type CryptoServiceImpl
- func (cs *CryptoServiceImpl) AfterInject() error
- func (cs *CryptoServiceImpl) CryptoDecrypt(ctx context.Context, req *pb.CryptoDecryptReq) (*pb.CryptoDecryptResp, error)
- func (cs *CryptoServiceImpl) CryptoEncrypt(ctx context.Context, req *pb.CryptoEncryptReq) (*pb.CryptoEncryptResp, error)
- func (cs *CryptoServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, ...) error
- type MysqlService
- type MysqlServiceImpl
- type PastebinService
- type PastebinServiceImpl
- func (ps *PastebinServiceImpl) AfterInject() error
- func (ps *PastebinServiceImpl) Parse(content, syntax string) string
- func (ps *PastebinServiceImpl) PastebinSubmit(ctx context.Context, req *pb.PastebinSubmitReq) (*pb.PastebinSubmitResp, error)
- func (ps *PastebinServiceImpl) RecentPosts() ([]table.Page, error)
- func (ps *PastebinServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, ...) error
- func (ps *PastebinServiceImpl) URLSearch(turl string) (*table.Page, error)
- type RedisService
- type RedisServiceImpl
- func (rs *RedisServiceImpl) AfterInject() error
- func (rs *RedisServiceImpl) Del(key string) error
- func (rs *RedisServiceImpl) Get(key string) (string, error)
- func (rs *RedisServiceImpl) GetExpireAt(key string) (time.Time, error)
- func (rs *RedisServiceImpl) Ping() error
- func (rs *RedisServiceImpl) Set(key string, token string, duration time.Duration) error
- type TinyURLService
- type TinyURLServiceImpl
- func (ts *TinyURLServiceImpl) AfterInject() error
- func (ts *TinyURLServiceImpl) Encode(url string) string
- func (ts *TinyURLServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, ...) error
- func (ts *TinyURLServiceImpl) TinyURLDecode(ctx context.Context, req *pb.TinyURLDecodeReq) (*pb.TinyURLDecodeResp, error)
- func (ts *TinyURLServiceImpl) TinyURLEncode(ctx context.Context, req *pb.TinyURLEncodeReq) (*pb.TinyURLEncodeResp, error)
- func (ts *TinyURLServiceImpl) URLSearch(turl string) (string, error)
- type TraceService
- type TraceServiceImpl
- func (ts *TraceServiceImpl) AfterInject() error
- func (ts *TraceServiceImpl) Close() error
- func (ts *TraceServiceImpl) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
- func (ts *TraceServiceImpl) FromGinContext(c *gin.Context, serviceName string) opentracing.Span
- func (ts *TraceServiceImpl) GetTracer() trace.Trace
- func (ts *TraceServiceImpl) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error
- func (ts *TraceServiceImpl) StartSpan(operationName string) opentracing.Span
- type UserService
- type UserServiceImpl
- func (us *UserServiceImpl) AfterInject() error
- func (us *UserServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, ...) error
- func (us *UserServiceImpl) UserAuth(ctx context.Context, req *pb.UserAuthReq) (*pb.UserAuthResp, error)
- func (us *UserServiceImpl) UserInfo(ctx context.Context, req *pb.UserInfoReq) (*pb.UserInfoResp, error)
- func (us *UserServiceImpl) UserRefresh(ctx context.Context, req *pb.UserRefreshReq) (*pb.UserRefreshResp, error)
- func (us *UserServiceImpl) UserRegister(ctx context.Context, req *pb.UserRegisterReq) (*pb.UserRegisterResp, error)
- func (us *UserServiceImpl) UserTest(ctx context.Context, req *pb.UserTestReq) (*pb.UserTestResp, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicService ¶
type BasicService interface { ServeHome() string ServeToys() string ServeCrypto() string ServeTinyURL() string ServePastebin() string ServeStorage() string ServeAbout() string }
BasicService base service which retrun the static html
type BasicServiceImpl ¶
type BasicServiceImpl struct{}
BasicServiceImpl Web static service implement
func (*BasicServiceImpl) AfterInject ¶
func (bs *BasicServiceImpl) AfterInject() error
AfterInject do inject
func (*BasicServiceImpl) ServeAbout ¶
func (bs *BasicServiceImpl) ServeAbout() string
ServeAbout return the `about`
func (*BasicServiceImpl) ServeCrypto ¶
func (bs *BasicServiceImpl) ServeCrypto() string
ServeCrypto return the `toys/crypto`
func (*BasicServiceImpl) ServeHome ¶
func (bs *BasicServiceImpl) ServeHome() string
ServeHome return the `home`
func (*BasicServiceImpl) ServePastebin ¶
func (bs *BasicServiceImpl) ServePastebin() string
ServePastebin return the `toys/pastebin`
func (*BasicServiceImpl) ServeStorage ¶
func (bs *BasicServiceImpl) ServeStorage() string
ServeStorage return the `toys/storage`
func (*BasicServiceImpl) ServeTinyURL ¶
func (bs *BasicServiceImpl) ServeTinyURL() string
ServeTinyURL return the `toys/tinyurl`
func (*BasicServiceImpl) ServeToys ¶
func (bs *BasicServiceImpl) ServeToys() string
ServeToys return the `toys`
type BlogService ¶
type BlogService interface { URLSearch(uri string) (types.Blog, error) Parse(content string) string RecentBlogs() ([]types.Blog, error) }
BlogService blog service
type BlogServiceImpl ¶
type BlogServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"WebLogger"` // contains filtered or unexported fields }
BlogServiceImpl Web PasteBin service implement
func (*BlogServiceImpl) AfterInject ¶
func (bs *BlogServiceImpl) AfterInject() error
AfterInject do inject
func (*BlogServiceImpl) Parse ¶
func (ps *BlogServiceImpl) Parse(content string) string
func (*BlogServiceImpl) RecentBlogs ¶
func (bs *BlogServiceImpl) RecentBlogs() ([]types.Blog, error)
type CosService ¶
type CosService interface { Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error CosBucketURL(ctx context.Context, req *pb.CosBucketURLReq) (*pb.CosBucketURLResp, error) CosPut(ctx context.Context, req *pb.CosPutReq) (*pb.CosPutResp, error) CosGet(ctx context.Context, req *pb.CosGetReq) (*pb.CosGetResp, error) }
CosService cos service
type CosServiceImpl ¶
type CosServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"WebLogger"` // contains filtered or unexported fields }
CosServiceImpl COS service implement
func (*CosServiceImpl) AfterInject ¶
func (cs *CosServiceImpl) AfterInject() error
AfterInject do inject
func (*CosServiceImpl) CosBucketURL ¶
func (cs *CosServiceImpl) CosBucketURL(ctx context.Context, req *pb.CosBucketURLReq) (*pb.CosBucketURLResp, error)
CosBucketURL return the BucketURL
func (*CosServiceImpl) CosGet ¶
func (cs *CosServiceImpl) CosGet(ctx context.Context, req *pb.CosGetReq) (*pb.CosGetResp, error)
CosGet get file from COS storage There is no need for server to do this, we can download from URI directly.
func (*CosServiceImpl) CosPut ¶
func (cs *CosServiceImpl) CosPut(ctx context.Context, req *pb.CosPutReq) (*pb.CosPutResp, error)
CosGet put file to COS storage
type CryptoService ¶
type CryptoService interface { Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error CryptoEncrypt(ctx context.Context, req *crypto.CryptoEncryptReq) (*crypto.CryptoEncryptResp, error) CryptoDecrypt(ctx context.Context, req *crypto.CryptoDecryptReq) (*crypto.CryptoDecryptResp, error) }
CryptoService crypto service which encrypt and decrypt text
type CryptoServiceImpl ¶
type CryptoServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"WebLogger"` // contains filtered or unexported fields }
CryptoServiceImpl Web crypto service implement
func (*CryptoServiceImpl) AfterInject ¶
func (cs *CryptoServiceImpl) AfterInject() error
AfterInject do inject
func (*CryptoServiceImpl) CryptoDecrypt ¶
func (cs *CryptoServiceImpl) CryptoDecrypt(ctx context.Context, req *pb.CryptoDecryptReq) (*pb.CryptoDecryptResp, error)
CryptoDecrypt decrypt
func (*CryptoServiceImpl) CryptoEncrypt ¶
func (cs *CryptoServiceImpl) CryptoEncrypt(ctx context.Context, req *pb.CryptoEncryptReq) (*pb.CryptoEncryptResp, error)
CryptoEncrypt encrypt
type MysqlService ¶
type MysqlService interface { Sync2() error GetEngineG() *xorm.EngineGroup }
MysqlService mysql service
type MysqlServiceImpl ¶
type MysqlServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"MysqlLogger"` ZapLogger *zap.Logger `inject-name:"ZapLogger"` EngineG *xorm.EngineGroup }
MysqlServiceImpl inplement of MysqlService
func (*MysqlServiceImpl) AfterInject ¶
func (ms *MysqlServiceImpl) AfterInject() error
AfterInject inject
func (*MysqlServiceImpl) GetEngineG ¶
func (ms *MysqlServiceImpl) GetEngineG() *xorm.EngineGroup
GetEngineG return Engine Group
type PastebinService ¶
type PastebinService interface { Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error PastebinSubmit(ctx context.Context, req *pastebin.PastebinSubmitReq) (*pastebin.PastebinSubmitResp, error) URLSearch(turl string) (*table.Page, error) Parse(content, syntax string) string RecentPosts() ([]table.Page, error) }
PastebinService pastebin service
type PastebinServiceImpl ¶
type PastebinServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"WebLogger"` RedisSvc RedisService `inject-name:"RedisService"` MysqlSvc MysqlService `inject-name:"MysqlService"` TinyURLSvc TinyURLService `inject-name:"TinyURLService"` // contains filtered or unexported fields }
PastebinServiceImpl Web PasteBin service implement
func (*PastebinServiceImpl) AfterInject ¶
func (ps *PastebinServiceImpl) AfterInject() error
AfterInject do inject
func (*PastebinServiceImpl) Parse ¶
func (ps *PastebinServiceImpl) Parse(content, syntax string) string
Parse the content to markdown... etc.
func (*PastebinServiceImpl) PastebinSubmit ¶
func (ps *PastebinServiceImpl) PastebinSubmit(ctx context.Context, req *pb.PastebinSubmitReq) (*pb.PastebinSubmitResp, error)
PastebinSubmit the text to DB
func (*PastebinServiceImpl) RecentPosts ¶
func (ps *PastebinServiceImpl) RecentPosts() ([]table.Page, error)
RecentPosts show the recent posts
type RedisService ¶
type RedisService interface { Ping() error Set(string, string, time.Duration) error Get(string) (string, error) Del(string) error GetExpireAt(string) (time.Time, error) }
RedisService redis service
type RedisServiceImpl ¶
type RedisServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"RedisLogger"` // contains filtered or unexported fields }
RedisServiceImpl inplement of RedisService
func (*RedisServiceImpl) AfterInject ¶
func (rs *RedisServiceImpl) AfterInject() error
AfterInject do inject
func (*RedisServiceImpl) Get ¶
func (rs *RedisServiceImpl) Get(key string) (string, error)
Get get key
func (*RedisServiceImpl) GetExpireAt ¶
func (rs *RedisServiceImpl) GetExpireAt(key string) (time.Time, error)
GetExpireAt get key expire-time
type TinyURLService ¶
type TinyURLService interface { Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error TinyURLEncode(ctx context.Context, req *tinyurl.TinyURLEncodeReq) (*tinyurl.TinyURLEncodeResp, error) TinyURLDecode(ctx context.Context, req *tinyurl.TinyURLDecodeReq) (*tinyurl.TinyURLDecodeResp, error) Encode(url string) string URLSearch(turl string) (string, error) }
TinyURLService tinyurl service
type TinyURLServiceImpl ¶
type TinyURLServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"WebLogger"` RedisSvc RedisService `inject-name:"RedisService"` MysqlSvc MysqlService `inject-name:"MysqlService"` // contains filtered or unexported fields }
TinyURLServiceImpl Web TinyURL service implement
func (*TinyURLServiceImpl) AfterInject ¶
func (ts *TinyURLServiceImpl) AfterInject() error
AfterInject do inject
func (*TinyURLServiceImpl) Encode ¶
func (ts *TinyURLServiceImpl) Encode(url string) string
Encode return the encode string directly
func (*TinyURLServiceImpl) Register ¶
func (ts *TinyURLServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error
Register the service
func (*TinyURLServiceImpl) TinyURLDecode ¶
func (ts *TinyURLServiceImpl) TinyURLDecode(ctx context.Context, req *pb.TinyURLDecodeReq) (*pb.TinyURLDecodeResp, error)
TinyURLDecode return the origin-url of tiny-url
func (*TinyURLServiceImpl) TinyURLEncode ¶
func (ts *TinyURLServiceImpl) TinyURLEncode(ctx context.Context, req *pb.TinyURLEncodeReq) (*pb.TinyURLEncodeResp, error)
TinyURLEncode return the tiny-url of origin-url
type TraceService ¶
type TraceService interface { StartSpan(operationName string) opentracing.Span Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error) Close() error GetTracer() trace.Trace FromGinContext(c *gin.Context, serviceName string) opentracing.Span }
TraceService trace service
type TraceServiceImpl ¶
type TraceServiceImpl struct { Config *config.Config `inject-name:"Config"` // contains filtered or unexported fields }
TraceServiceImpl inplement of TraceService
func (*TraceServiceImpl) AfterInject ¶
func (ts *TraceServiceImpl) AfterInject() error
AfterInject inject
func (*TraceServiceImpl) Extract ¶
func (ts *TraceServiceImpl) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
Extract return the tracer's impl
func (*TraceServiceImpl) FromGinContext ¶
func (ts *TraceServiceImpl) FromGinContext(c *gin.Context, serviceName string) opentracing.Span
FromGinContext start a new span from gin context
func (*TraceServiceImpl) GetTracer ¶
func (ts *TraceServiceImpl) GetTracer() trace.Trace
GetTracer return the tracer
func (*TraceServiceImpl) Inject ¶
func (ts *TraceServiceImpl) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error
Inject return the tracer's impl
func (*TraceServiceImpl) StartSpan ¶
func (ts *TraceServiceImpl) StartSpan(operationName string) opentracing.Span
StartSpan return the tracer's impl
type UserService ¶
type UserService interface { Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error UserTest(ctx context.Context, req *user.UserTestReq) (*user.UserTestResp, error) UserRegister(ctx context.Context, req *user.UserRegisterReq) (*user.UserRegisterResp, error) UserAuth(ctx context.Context, req *user.UserAuthReq) (*user.UserAuthResp, error) UserRefresh(ctx context.Context, req *user.UserRefreshReq) (*user.UserRefreshResp, error) UserInfo(ctx context.Context, req *user.UserInfoReq) (*user.UserInfoResp, error) }
UserService user service
type UserServiceImpl ¶
type UserServiceImpl struct { Config *config.Config `inject-name:"Config"` Logger log.Logger `inject-name:"GRPCLogger"` RedisSvc RedisService `inject-name:"RedisService"` MysqlSvc MysqlService `inject-name:"MysqlService"` }
UserServiceImpl GRPC user service implement
func (*UserServiceImpl) AfterInject ¶
func (us *UserServiceImpl) AfterInject() error
AfterInject do inject
func (*UserServiceImpl) Register ¶
func (us *UserServiceImpl) Register(ctx context.Context, gsrv *grpc.Server, gwmux *runtime.ServeMux, opts []grpc.DialOption) error
Register the service
func (*UserServiceImpl) UserAuth ¶
func (us *UserServiceImpl) UserAuth(ctx context.Context, req *pb.UserAuthReq) (*pb.UserAuthResp, error)
UserAuth auth
func (*UserServiceImpl) UserInfo ¶
func (us *UserServiceImpl) UserInfo(ctx context.Context, req *pb.UserInfoReq) (*pb.UserInfoResp, error)
UserInfo user information
func (*UserServiceImpl) UserRefresh ¶
func (us *UserServiceImpl) UserRefresh(ctx context.Context, req *pb.UserRefreshReq) (*pb.UserRefreshResp, error)
UserRefresh refresh token
func (*UserServiceImpl) UserRegister ¶
func (us *UserServiceImpl) UserRegister(ctx context.Context, req *pb.UserRegisterReq) (*pb.UserRegisterResp, error)
UserRegister register
func (*UserServiceImpl) UserTest ¶
func (us *UserServiceImpl) UserTest(ctx context.Context, req *pb.UserTestReq) (*pb.UserTestResp, error)
UserTest for test