Versions in this module Expand all Collapse all v0 v0.0.1 Aug 22, 2023 Changes in this version + const KeyRequester + var ErrBadRequest = DefaultError + var ErrConflict = DefaultError + var ErrForbidden = DefaultError + var ErrInternalServerError = DefaultError + var ErrNotFound = DefaultError + var ErrTimeout = DefaultError + var ErrUnauthorized = DefaultError + var ErrUnsupportedMediaType = DefaultError + func ContextWithRequester(ctx context.Context, requester Requester) context.Context + func ErrorResponse(ctx *gin.Context, err error) + func NewDataResponse(data interface{}) *successResponse + func NewRequester(id, uid string) *requesterData + func NewResponse(data, paging, extra interface{}) *successResponse + func NewSubscriberEngine(name string, ps PubSubComponent, ac appctx.AppContext) *subscriberEngine + func SuccessResponse(ctx *gin.Context, data *successResponse) + type CacheComponent interface + Delete func(ctx context.Context, key string) error + Get func(ctx context.Context, key string, value interface{}) error + Set func(ctx context.Context, key string, value interface{}, ttl time.Duration) error + type DBMigrationComponent interface + MigrateDown func() + MigrateUp func() + type DebugCarrier interface + Debug func() string + type DefaultError struct + CodeField int + DebugField string + DetailsField map[string]interface{} + ErrorField string + GRPCCodeField codes.Code + IDField string + RIDField string + ReasonField string + StatusField string + func ToDefaultError(err error, requestID string) *DefaultError + func (e *DefaultError) StackTrace() (trace errors.StackTrace) + func (e *DefaultError) WithTrace(err error) *DefaultError + func (e *DefaultError) Wrap(err error) + func (e DefaultError) Debug() string + func (e DefaultError) Details() map[string]interface{} + func (e DefaultError) Error() string + func (e DefaultError) Format(s fmt.State, verb rune) + func (e DefaultError) GRPCStatus() *status.Status + func (e DefaultError) ID() string + func (e DefaultError) Is(err error) bool + func (e DefaultError) Reason() string + func (e DefaultError) RequestID() string + func (e DefaultError) Status() string + func (e DefaultError) StatusCode() int + func (e DefaultError) Unwrap() error + func (e DefaultError) WithDebug(debug string) *DefaultError + func (e DefaultError) WithDebugf(debug string, args ...interface{}) *DefaultError + func (e DefaultError) WithDetail(key string, detail interface{}) *DefaultError + func (e DefaultError) WithDetailf(key string, message string, args ...interface{}) *DefaultError + func (e DefaultError) WithError(message string) *DefaultError + func (e DefaultError) WithErrorf(message string, args ...interface{}) *DefaultError + func (e DefaultError) WithID(id string) *DefaultError + func (e DefaultError) WithReason(reason string) *DefaultError + func (e DefaultError) WithReasonf(reason string, args ...interface{}) *DefaultError + func (e DefaultError) WithWrap(err error) *DefaultError + type DetailsCarrier interface + Details func() map[string]interface{} + type EmailComponent interface + SendEmail func(subject string, content string, to []string, cc []string, bcc []string, ...) error + type GRPCClientComponent interface + Dial func(options ...grpc.DialOption) *grpc.ClientConn + DialContext func(ctx context.Context, options ...grpc.DialOption) *grpc.ClientConn + GetAddress func() string + GetLogger func() appctx.Logger + WithAddress func(address string) + WithPrefix func(prefix string) + type GRPCServerComponent interface + GetGateway func() *runtime.ServeMux + GetLogger func() appctx.Logger + GetServer func() *grpc.Server + Start func(ctx context.Context) + WithAddress func(address string) + WithListener func(lis net.Listener) + WithServeMuxOptions func(muxOpts ...runtime.ServeMuxOption) + WithServerOptions func(serverOpts ...grpc.ServerOption) + WithStreamInterceptors func(interceptors ...grpc.StreamServerInterceptor) + WithUnaryInterceptors func(interceptors ...grpc.UnaryServerInterceptor) + type GinComponent interface + GetAddress func() string + GetRouter func() *gin.Engine + Start func() + StartGracefully func() + type GormDBComponent interface + GetDB func() *gorm.DB + type GroupSubJob interface + Run func(ctx context.Context) error + type IDCarrier interface + ID func() string + type Image struct + Height int + ID int + Name string + Path string + Provider string + URL string + Width int + func (Image) TableName() string + func (img *Image) Fulfill(domain string) + func (img *Image) Scan(value interface{}) error + func (img *Image) Value() (driver.Value, error) + type Images []Image + func (i *Images) Scan(value interface{}) error + func (i *Images) Value() (driver.Value, error) + type Paging struct + FakeCursor string + Limit int + NextCursor string + Page int + Total int64 + func (p *Paging) Process() + type PubSubComponent interface + Publish func(ctx context.Context, topic pubsub.Topic, msg *pubsub.Message) error + Subscribe func(ctx context.Context, topic pubsub.Topic) (ch <-chan *pubsub.Message, unsubscribeFunc func()) + type ReasonCarrier interface + Reason func() string + type RedisDBComponent interface + GetDB func() *redis.Client + type RequestIDCarrier interface + RequestID func() string + type Requester interface + GetID func() string + GetUID func() string + func GetRequester(ctx context.Context) Requester + type SQLModel struct + CreatedAt *time.Time + FakeID *util.UID + ID int + UpdatedAt *time.Time + func NewSQLModel() SQLModel + func (sqlModel *SQLModel) Mask(objectId int) + type SimpleUser struct + Avatar *Image + FirstName string + LastName string + func NewSimpleUser(id int, firstName, lastName string, avatar *Image) SimpleUser + func (SimpleUser) TableName() string + type StatusCarrier interface + Status func() string + type StatusCodeCarrier interface + StatusCode func() int + type StorageComponent interface + DeleteFiles func(ctx context.Context, keys []string) error + GetPresignedURL func(ctx context.Context, key string, expiration time.Duration) (string, error) + GetPresignedURLs func(ctx context.Context, keys []string, expiration time.Duration) (map[string]string, error) + UploadFile func(ctx context.Context, data []byte, key string, contentType string) (url string, storageName string, err error) + type SubJob struct + Hdl func(ctx context.Context, msg *pubsub.Message) error + Name string + type TokenMakerComponent interface + CreateToken func(tokenType token.TokenType, uid string, duration ...time.Duration) (string, *token.Payload, error) + VerifyToken func(token string) (*token.Payload, error)