domain

package
v0.0.0-...-3ec4966 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NOTIFICATION_STATUS_ACTIVE    = 1
	NOTIFICATION_STATUS_SCHEDULED = 2
	NOTIFICATION_STATUS_CANCELED  = 3
	NOTIFICATION_STATUS_FINISHED  = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCache

type AuthCache interface {
	GetTokenExpiry() time.Duration
	GetUserByToken(ctx context.Context, token string) (string, int, error)
	GenerateAndSaveToken(ctx context.Context, email string, id int) (string, error)
	DeleteToken(ctx context.Context, token string) error
}

type AuthToken

type AuthToken struct {
	AccessToken string
	TokenType   string
	ExpiresIn   time.Duration
}

func (*AuthToken) MarshalJSON

func (m *AuthToken) MarshalJSON() ([]byte, error)

type Notification

type Notification struct {
	ID           int        `json:"id"`
	PID          string     `json:"pid"`
	Status       int        `json:"status"`
	Title        string     `json:"title"`
	Text         string     `json:"text"`
	BigText      *string    `json:"big-text,omitempty"`
	Image        *string    `json:"image,omitempty"`
	BigImage     *string    `json:"big-image,omitempty"`
	Priority     string     `json:"priority"`
	Style        string     `json:"style"`
	Action       *string    `json:"action,omitempty"`
	Extra        *string    `json:"extra,omitempty"`
	ViewsCount   int        `json:"views"`
	ClicksCount  int        `json:"clicks"`
	CreateTime   *time.Time `json:"create_time"`
	ActiveTime   *time.Time `json:"active_time"`
	ExpireTime   *time.Time `json:"expire_time"`
	ScheduleTime *time.Time `json:"schedule_time"`
	ClickReport  bool       `json:"click_report"`
}

type NotificationCache

type NotificationCache interface {
	LoadScripts(ctx context.Context) error
	GetTimeByProjectID(ctx context.Context, pid string) (*time.Time, error)
	GetDataExistsByProjectID(ctx context.Context, pid string) (bool, error)
	GetDataByProjectID(ctx context.Context, pid string) (*string, error)
	GetViewsByProjectID(ctx context.Context, pid string) (string, error)
	UpdateProjectData(ctx context.Context, pid string, ids string, data string, t time.Time, expire time.Duration) error
	DeleteProjectData(ctx context.Context, pid string) error
	SetProjectDataExpire(ctx context.Context, pid string, expiration time.Duration) error
	GetClicksByProjectID(ctx context.Context, pid string) (map[string]string, error)
	IncrClicks(ctx context.Context, pid string, id string) error
	IncrClicksIds(ctx context.Context, pid string, ids []string) error
}

type NotificationRepository

type NotificationRepository interface {
	GetByID(ctx context.Context, id int) (*Notification, error)
	GetByPID(ctx context.Context, pid string, limit int, offset int) ([]Notification, error)
	Insert(ctx context.Context, n *Notification) error
	Update(ctx context.Context, n *Notification) error
	Delete(ctx context.Context, n *Notification) error
}

type Project

type Project struct {
	ID     string `json:"id"`
	UserID int    `json:"uid"`
	Name   string `json:"name"`
}

type ProjectRepository

type ProjectRepository interface {
	GetByID(ctx context.Context, id string) (*Project, error)
	GetProjectsByUserID(ctx context.Context, uid int) ([]Project, error)
	Insert(ctx context.Context, project *Project) error
	Update(ctx context.Context, project *Project) error
	Delete(ctx context.Context, project *Project) error
}

type RemoteConfig

type RemoteConfig struct {
	ProjectID string
	Data      string
	Version   int
}

func (*RemoteConfig) MarshalJSON

func (r *RemoteConfig) MarshalJSON() ([]byte, error)

type RemoteConfigCache

type RemoteConfigCache interface {
	LoadScripts(ctx context.Context) error
	GetDataExistsByProjectID(ctx context.Context, pid string) (bool, error)
	GetDataByProjectID(ctx context.Context, pid string) (*string, error)
	GetVersionByProjectID(ctx context.Context, pid string) (*int, error)
	Update(ctx context.Context, rc *RemoteConfig) error
}

type RemoteConfigRepository

type RemoteConfigRepository interface {
	GetByProjectID(ctx context.Context, pid string) (*RemoteConfig, error)
	Insert(ctx context.Context, rc *RemoteConfig) error
	Update(ctx context.Context, rc *RemoteConfig) error
}

type User

type User struct {
	ID           int    `json:"id"`
	Email        string `json:"email"`
	ProjectQuota int    `json:"project_quota"`
	NumProjects  int    `json:"num_projects"`
}

type UserRepository

type UserRepository interface {
	GetByEmail(ctx context.Context, email string) (*User, error)
	Insert(ctx context.Context, user *User) error
	Update(ctx context.Context, user *User) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL