Documentation
¶
Index ¶
- Constants
- Variables
- type Controller
- type Database
- type DatabaseService
- type Duration
- type ExternalServicesService
- type GithubService
- type Handler
- type HeartbeatsResponse
- type HeartbeatsResponseData
- type HttpMethod
- type HttpService
- type ListRepositoriesCallback
- type MainService
- type MessagesService
- type MiddlewareHandler
- type ProjectService
- type RedisClient
- type RepositoriesStored
- type Route
- type ServiceInitializer
- type ServiceSettings
- type ServiceStarter
- type StatsService
- type TasksService
- type TotalDevTimeResponse
- type TotalDevTimeResponseData
- type TotalDevTimeResponseDataRange
- type User
- type UsersService
- type WakatimeService
Constants ¶
View Source
const JwtAccessTokenLifetime = 15 * time.Minute
View Source
const JwtRefreshTokenLifetime = 24 * time.Hour
Variables ¶
View Source
var (
ErrProjectNotFound = errors.New("project not found")
)
View Source
var (
ErrUserNotFound = errors.New("user not found")
)
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type DatabaseService ¶
type DatabaseService interface { ServiceStarter AutoReconnect(database Database[any]) error Postgres() Database[*gorm.DB] Redis() Database[RedisClient] }
type ExternalServicesService ¶
type ExternalServicesService interface { ServiceInitializer Wakatime() WakatimeService Github() GithubService }
type GithubService ¶
type GithubService interface {
ListRepositoriesConcurrent(callback ListRepositoriesCallback) error
}
type HeartbeatsResponse ¶
type HeartbeatsResponse[T float64 | Duration] struct { Data []HeartbeatsResponseData[T] `json:"data"` }
type HeartbeatsResponseData ¶
type HttpMethod ¶
type HttpMethod int
const ( MethodGet HttpMethod = iota MethodPost MethodDelete MethodPut MethodPatch MethodAny )
func (HttpMethod) String ¶
func (m HttpMethod) String() string
func (HttpMethod) ToFunctionFromEngine ¶
func (m HttpMethod) ToFunctionFromEngine(app *gin.Engine) func(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
type HttpService ¶
type HttpService interface { ServiceInitializer ServiceStarter Engine() *gin.Engine RegisterRoutes(...*Route) RegisterControllers(...*Controller) }
type ListRepositoriesCallback ¶
type ListRepositoriesCallback func(repositories []*github.Repository, wg *sync.WaitGroup)
type MainService ¶
type MainService interface { Init() error Start(errCh chan error) Close() error Databases() DatabaseService Http() HttpService Projects() ProjectService ExternalServices() ExternalServicesService Stats() StatsService Tasks() TasksService Messages() MessagesService Users() UsersService }
type MessagesService ¶
type MessagesService interface { ServiceInitializer GetAllMessagesFromScopeId(scopeId uuid.UUID) (messages []*model.Message, err error) GetAllMessagesFromScope(scope string) (messages []*model.Message, err error) GetMessage(scope, key string) (message *model.Message, err error) AddMessage(message *model.Message) (err error) UpdateMessage(message *model.Message) (err error) AddTranslations(message *model.Message) (err error) GetScopeFromName(scopeName string) (scope *model.Scope, err error) }
type MiddlewareHandler ¶
type MiddlewareHandler func(c *gin.Context, user User, mainService MainService) (next bool)
type ProjectService ¶
type RedisClient ¶
type RedisClient interface { Base() *redis.Client ReJson() *rejson.Handler GetJsonString(key, path string) (string, error) GetJsonInt(key, path string) (int, error) GetJsonFloat(key, path string) (float64, error) GetJsonBool(key, path string) (bool, error) GetJsonObject(key, path string, object interface{}) error }
type RepositoriesStored ¶
type RepositoriesStored struct { PublicRepositories int `json:"publicRepositories"` PrivateRepositories int `json:"privateRepositories"` PublicOwnedRepositories int `json:"publicOwnedRepositories"` }
func (RepositoriesStored) MarshalBinary ¶
func (r RepositoriesStored) MarshalBinary() ([]byte, error)
func (*RepositoriesStored) UnmarshalBinary ¶
func (r *RepositoriesStored) UnmarshalBinary(data []byte) error
type Route ¶
type Route struct { Path string Method HttpMethod IsAuthenticated bool AuthenticateMiddleware func(c *gin.Context, user User, mainService MainService) Middlewares []MiddlewareHandler Handler Handler }
type ServiceInitializer ¶
type ServiceInitializer interface {
Init(service MainService) error
}
type ServiceSettings ¶
type ServiceStarter ¶
type ServiceStarter interface { Start() error Close() error Settings() ServiceSettings }
type StatsService ¶
type StatsService interface { ServiceInitializer GetTotalDevTime() (*TotalDevTimeResponse[Duration], error) GetBestDevTimeDay() (Duration, error) IsDeveloping() (bool, error) GetVisitorCount() (int, error) ListRepositories() (*RepositoriesStored, error) }
type TasksService ¶
type TasksService interface { ServiceInitializer ServiceStarter CheckWakatimeActivityTask() error }
type TotalDevTimeResponse ¶
type TotalDevTimeResponse[T float64 | Duration] struct { Data TotalDevTimeResponseData[T] `json:"data"` }
func (TotalDevTimeResponse[T]) MarshalBinary ¶
func (t TotalDevTimeResponse[T]) MarshalBinary() ([]byte, error)
func (*TotalDevTimeResponse[T]) UnmarshalBinary ¶
func (t *TotalDevTimeResponse[T]) UnmarshalBinary(data []byte) error
type TotalDevTimeResponseData ¶
type TotalDevTimeResponseData[T float64 | Duration] struct { Range TotalDevTimeResponseDataRange `json:"range"` TotalSeconds T `json:"total_seconds"` }
type UsersService ¶
type UsersService interface { ServiceInitializer GetUser(id uint, withPassword ...bool) (User, error) GetUserByUsername(username string, withPassword ...bool) (User, error) GetUserByEmail(email string, withPassword ...bool) (User, error) ListUsers() ([]User, error) Register(user User) error IsExist(email string) bool }
type WakatimeService ¶
type WakatimeService interface { GetTotalDevTime() (*TotalDevTimeResponse[Duration], error) GetBestDevTimeDay() (Duration, error) GetTodayHeartbeats() (*HeartbeatsResponse[Duration], error) GetLastTodayHeartbeat() (Duration, error) }
Click to show internal directories.
Click to hide internal directories.