Documentation ¶
Index ¶
- Constants
- func JWTMiddleware(cfg *jwt.Config, checkOTP bool) wool.Middleware
- func NewChatCRUD(read repository.ReadRepository[*entity.Chat], ...) action.CRUD
- func NewJobCRUD(read repository.ReadRepository[*entity.Job], ...) action.CRUD
- func NewSiteCRUD(read repository.ReadRepository[*entity.Site], ...) action.CRUD
- type ArticleActions
- type AuthActions
- type AuthDTO
- type AuthService
- type CreateChatDTO
- type CreateJobDTO
- type CreateSiteDTO
- type DailyStats
- type FeedPayloadDTO
- type JobOptionDTO
- type MediaDTO
- type OtpDTO
- type QueueActions
- type QueueInfo
- type RefreshTokenDTO
- type SSE
- type SchedulerEntry
- type Session
- type SignInDTO
- type SitemapPayloadDTO
- type StatsResponse
- type Sys
- type UpdateArticleDTO
- type UpdateChatDTO
- type UpdateJobDTO
- type UpdateSiteDTO
- type UserClaims
Constants ¶
View Source
const QNameParam = "qname"
Variables ¶
This section is empty.
Functions ¶
func JWTMiddleware ¶
func JWTMiddleware(cfg *jwt.Config, checkOTP bool) wool.Middleware
func NewChatCRUD ¶
func NewChatCRUD(read repository.ReadRepository[*entity.Chat], write repository.WriteRepository[*entity.Chat]) action.CRUD
func NewJobCRUD ¶
func NewJobCRUD(read repository.ReadRepository[*entity.Job], write repository.WriteRepository[*entity.Job]) action.CRUD
func NewSiteCRUD ¶
func NewSiteCRUD(read repository.ReadRepository[*entity.Site], write repository.WriteRepository[*entity.Site]) action.CRUD
Types ¶
type ArticleActions ¶
type ArticleActions struct { *action.ListAction[*entity.Article, any] *action.TakeAction[*entity.Article, any] *action.UpdateAction[*UpdateArticleDTO, *entity.Article] *action.DeleteAction[*entity.Article] }
func NewArticleActions ¶
func NewArticleActions( read repository.ReadRepository[*entity.Article], write repository.WriteRepository[*entity.Article], ) *ArticleActions
type AuthActions ¶
type AuthActions struct { AuthService AuthService // contains filtered or unexported fields }
func NewAuthActions ¶
func NewAuthActions(authService AuthService, logger *slog.Logger) *AuthActions
type AuthDTO ¶
type AuthDTO struct {
ClientID string `json:"client_id,omitempty" validate:"required,uuid4"`
}
type AuthService ¶
type AuthService interface { SignInByCredentials(ctx context.Context, username, password string) (Session, error) SignInByOTP(ctx context.Context, username, password string) (Session, error) SignInByRefreshToken(ctx context.Context, refreshToken string) (Session, error) }
func NewAuthService ¶
func NewAuthService( userRepo repository.ReadRepository[*entity.SysUser], client redis.UniversalClient, signer jwt.Signer, cfgJWT *jwt.Config, ) AuthService
type CreateChatDTO ¶
type CreateChatDTO struct { TelegramID int64 `json:"telegram_id,omitempty" validate:"required"` Type entity.ChatType `json:"type,omitempty" validate:"required,oneof=private group supergroup channel"` Title string `json:"title,omitempty" validate:"omitempty,max=254"` Username string `json:"username,omitempty" validate:"omitempty,max=254"` FirstName string `json:"first_name,omitempty" validate:"omitempty,max=254"` LastName string `json:"last_name,omitempty" validate:"omitempty,max=254"` Broadcast []string `json:"broadcast,omitempty" validate:"omitempty,dive,uuid4"` Blocked bool `json:"blocked,omitempty"` Deleted bool `json:"deleted,omitempty"` }
type CreateJobDTO ¶
type CreateJobDTO struct { CronExpr string `json:"cron_expr,omitempty" validate:"required,min=9,max=254"` Name entity.JobName `json:"name,omitempty" validate:"required,max=254"` Payload any `json:"payload,omitempty" validate:"required,dive"` Options []JobOptionDTO `json:"options,omitempty" validate:"omitempty,dive"` Enabled bool `json:"enabled,omitempty"` }
func (*CreateJobDTO) UnmarshalJSON ¶
func (dto *CreateJobDTO) UnmarshalJSON(data []byte) error
type CreateSiteDTO ¶
type CreateSiteDTO struct { Domain string `json:"domain,omitempty" validate:"required,fqdn"` Favicon string `json:"favicon,omitempty" validate:"required,url"` Languages []string `json:"languages,omitempty" validate:"required,min=1,dive,bcp47_language_tag"` Title string `json:"title,omitempty" validate:"required,max=254"` Enabled bool `json:"enabled,omitempty"` }
type DailyStats ¶
type FeedPayloadDTO ¶
type JobOptionDTO ¶
type JobOptionDTO struct { Type entity.JobOptionType `json:"type,omitempty" validate:"required,max=50"` Value string `json:"value,omitempty" validate:"required"` }
type OtpDTO ¶
type OtpDTO struct {
Password string `json:"password,omitempty" validate:"required,numeric,len=6"`
}
type QueueActions ¶
type QueueActions struct {
// contains filtered or unexported fields
}
func NewQueueActions ¶
func NewQueueActions(redisConnOpt asynq.RedisConnOpt) *QueueActions
func (*QueueActions) Close ¶
func (a *QueueActions) Close() error
type QueueInfo ¶
type QueueInfo struct { // Name of the queue. Queue string `json:"queue"` // Total number of bytes the queue and its tasks require to be stored in redis. MemoryUsage int64 `json:"memory_usage_bytes"` // Total number of tasks in the queue. Size int `json:"size"` // Totoal number of groups in the queue. Groups int `json:"groups"` // Latency of the queue in milliseconds. LatencyMillisec int64 `json:"latency_msec"` // Latency duration string for display purpose. DisplayLatency string `json:"display_latency"` // Number of tasks in each state. Active int `json:"active"` Pending int `json:"pending"` Aggregating int `json:"aggregating"` Scheduled int `json:"scheduled"` Retry int `json:"retry"` Archived int `json:"archived"` Completed int `json:"completed"` // Total number of tasks processed during the given date. // The number includes both succeeded and failed tasks. Processed int `json:"processed"` // Breakdown of processed tasks. Succeeded int `json:"succeeded"` Failed int `json:"failed"` // Paused indicates whether the queue is paused. // If true, tasks in the queue will not be processed. Paused bool `json:"paused"` // Time when this snapshot was taken. Timestamp time.Time `json:"timestamp"` }
type RefreshTokenDTO ¶
type RefreshTokenDTO struct {
RefreshToken string `json:"refresh_token" validate:"required,uuid4"`
}
type SchedulerEntry ¶
type SchedulerEntry struct { ID string `json:"id"` Spec string `json:"spec"` JobName string `json:"job_name"` JobPayload json.RawMessage `json:"job_payload"` Opts []string `json:"options"` NextEnqueueAt time.Time `json:"next_enqueue_at"` // This field is omitted if there were no previous enqueue events. PrevEnqueueAt *time.Time `json:"prev_enqueue_at,omitempty"` }
type SitemapPayloadDTO ¶
type SitemapPayloadDTO struct { SiteID string `json:"site_id,omitempty" validate:"required,uuid4"` Link string `json:"link,omitempty" validate:"required,url"` Lang *string `json:"lang,omitempty" validate:"omitempty,bcp47_language_tag"` MatchLoc *string `json:"match_loc,omitempty" validate:"omitempty,max=500"` SearchLoc *string `json:"search_loc,omitempty" validate:"omitempty,max=500"` SearchLink *string `json:"search_link,omitempty" validate:"omitempty,max=500"` Index *bool `json:"index,omitempty"` StopOnDup *bool `json:"stop_on_dup,omitempty"` }
type StatsResponse ¶
type StatsResponse struct { Queues []*QueueInfo `json:"queues,omitempty"` DailyStats map[string][]*DailyStats `json:"daily_stats,omitempty"` SchedulerEntries []*SchedulerEntry `json:"scheduler_entries,omitempty"` }
type Sys ¶
type Sys struct { Logger *slog.Logger CfgJWT *jwt.Config SSE *SSE AuthActions *AuthActions QueueActions *QueueActions ArticleActions *ArticleActions SiteCRUD action.CRUD ChatCRUD action.CRUD JobCRUD action.CRUD DirUI *string }
type UpdateArticleDTO ¶
type UpdateArticleDTO struct { Lang string `json:"lang,omitempty" validate:"omitempty,bcp47_language_tag"` Title string `json:"title,omitempty" validate:"omitempty,max=254"` ShortDesc *string `json:"short_desc,omitempty" validate:"omitempty,max=500"` LongDesc *string `json:"long_desc,omitempty"` Media *[]MediaDTO `json:"media,omitempty" validate:"omitempty,dive"` Categories *[]string `json:"categories,omitempty" validate:"omitempty,dive,min=1,max=254"` }
type UpdateChatDTO ¶
type UpdateJobDTO ¶
type UpdateJobDTO struct { CronExpr string `json:"cron_expr,omitempty" validate:"omitempty,min=9,max=254"` Name entity.JobName `json:"name,omitempty" validate:"omitempty,max=254"` Payload any `json:"payload,omitempty" validate:"omitempty,dive"` Options *[]JobOptionDTO `json:"options,omitempty" validate:"omitempty,dive"` Enabled *bool `json:"enabled,omitempty"` }
func (*UpdateJobDTO) UnmarshalJSON ¶
func (dto *UpdateJobDTO) UnmarshalJSON(data []byte) error
type UpdateSiteDTO ¶
type UpdateSiteDTO struct { Domain string `json:"domain,omitempty" validate:"omitempty,fqdn"` Favicon string `json:"favicon,omitempty" validate:"required,url"` Languages []string `json:"languages,omitempty" validate:"omitempty,dive,bcp47_language_tag"` Title string `json:"title,omitempty" validate:"omitempty,max=254"` Enabled *bool `json:"enabled,omitempty"` }
type UserClaims ¶
type UserClaims struct {
jwt.UserClaims
}
func GetClaims ¶
func GetClaims(c wool.Ctx) UserClaims
func (UserClaims) Valid ¶
func (c UserClaims) Valid() error
Click to show internal directories.
Click to hide internal directories.