infrastructure

package
v2.0.0-...-57e25a4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGameLocalizer

func CreateGameLocalizer() core.ILocalizer

func CreateInMemoryChatStorage

func CreateInMemoryChatStorage() core.IChatStorage

func CreateInMemoryUserStorage

func CreateInMemoryUserStorage() core.IUserStorage

func CreateMathRand

func CreateMathRand() core.IRand

func CreateRabbitFactory

func CreateRabbitFactory(l core.ILogger, url string) (core.ITaskFactory, func())

func CreateSettingsStorage

func CreateSettingsStorage(dbFile string) core.ISettingsProvider

func CreateUserStorage

func CreateUserStorage(dbFile string, l core.ILogger) core.IUserStorage

Types

type Chat

type Chat struct {
	ID        int64 `gorm:"primaryKey"`
	Title     string
	Type      string
	CreatedAt time.Time `gorm:"autoUpdateTime"`
	UpdatedAt time.Time `gorm:"autoCreateTime"`
}

type ChatStorage

type ChatStorage struct {
	// contains filtered or unexported fields
}

ChatStorage implements core.IChatStorage interface

func CreateChatStorage

func CreateChatStorage(dbFile string, l core.ILogger) *ChatStorage

CreateChatStorage is a default ChatStorage factory

func (*ChatStorage) CreateChat

func (s *ChatStorage) CreateChat(chatID int64, title string, type_ string) error

CreateChat is a core.IChatStorage interface implementation

func (*ChatStorage) GetChatByID

func (s *ChatStorage) GetChatByID(chatID int64) (*core.Chat, error)

GetChatByID is a core.IChatStorage interface implementation

type CommonLocalizer

type CommonLocalizer struct {
	// contains filtered or unexported fields
}

CommonLocalizer for faggot game

func CreateCommonLocalizer

func CreateCommonLocalizer() *CommonLocalizer

func (*CommonLocalizer) AllKeys

func (l *CommonLocalizer) AllKeys() []string

AllKeys is a core.ILocalizer implementation

func (*CommonLocalizer) I18n

func (l *CommonLocalizer) I18n(lang, key string, args ...interface{}) string

I18n is a core.ILocalizer implementation

type FfmpegConverter

type FfmpegConverter struct {
	// contains filtered or unexported fields
}

FfmpegConverter implements core.IVideoConverter and core.IVideoFactory using ffmpeg

func CreateFfmpegConverter

func CreateFfmpegConverter(l core.ILogger) *FfmpegConverter

CreateFfmpegConverter is a basic FfmpegConverter factory

func (*FfmpegConverter) Convert

func (c *FfmpegConverter) Convert(vf *core.Video, bitrate int) (*core.Video, error)

Convert is a core.IVideoConverter interface implementation

func (*FfmpegConverter) CreateMedia

func (c *FfmpegConverter) CreateMedia(url string) ([]*core.Media, error)

CreateMedia is a core.IMediaFactory interface implementation

func (*FfmpegConverter) CreateVideo

func (c *FfmpegConverter) CreateVideo(path string) (*core.Video, error)

CreateVideo is a core.IVideoFactory interface implementation

func (*FfmpegConverter) GetCodec

func (c *FfmpegConverter) GetCodec(path string) string

GetCodec is a core.IVideoConverter interface implementation

func (*FfmpegConverter) Split

func (c *FfmpegConverter) Split(video *core.Video, limit int) ([]*core.Video, error)

CreateVideo is a core.IVideoSplitter interface implementation

type FileDownloader

type FileDownloader struct {
	// contains filtered or unexported fields
}

FileDownloader is a default implementation for core.IFileDownloader

func CreateFileDownloader

func CreateFileDownloader(l core.ILogger) *FileDownloader

CreateFileDownloader is a default FileDownloader factory

func (*FileDownloader) Download

func (downloader *FileDownloader) Download(url core.URL, filepath string) (*core.File, error)

Download is a core.IFileDownloader interface implementation

type GameLocalizer

type GameLocalizer struct {
	// contains filtered or unexported fields
}

GameLocalizer for faggot game

func (*GameLocalizer) AllKeys

func (l *GameLocalizer) AllKeys() []string

AllKeys is a core.ILocalizer implementation

func (*GameLocalizer) I18n

func (l *GameLocalizer) I18n(lang, key string, args ...interface{}) string

I18n is a core.ILocalizer implementation

type GameStorage

type GameStorage struct {
	// contains filtered or unexported fields
}

GameStorage implements core.IGameStorage interface

func CreateGameStorage

func CreateGameStorage(dbFile string) *GameStorage

CreateGameStorage is a default GameStorage factory

func (*GameStorage) AddPlayer

func (s *GameStorage) AddPlayer(gameID int64, user *core.User) error

AddPlayer is a core.IGameStorage interface implementation

func (*GameStorage) AddRound

func (s *GameStorage) AddRound(gameID int64, round *core.Round) error

AddRound is a core.IGameStorage interface implementation

func (*GameStorage) GetPlayers

func (s *GameStorage) GetPlayers(gameID int64) ([]*core.User, error)

GetPlayers is a core.IGameStorage interface implementation

func (*GameStorage) GetRounds

func (s *GameStorage) GetRounds(gameID int64) ([]*core.Round, error)

GetRounds is a core.IGameStorage interface implementation

func (*GameStorage) UpdatePlayer

func (s *GameStorage) UpdatePlayer(gameID int64, user *core.User) error

AddPlayer is a core.IGameStorage interface implementation

type InMemoryChatStorage

type InMemoryChatStorage struct {
	// contains filtered or unexported fields
}

func (*InMemoryChatStorage) CreateChat

func (storage *InMemoryChatStorage) CreateChat(chatID int64, title string, type_ string) error

CreateChat is a core.IChatStorage interface implementation

func (*InMemoryChatStorage) GetChatByID

func (storage *InMemoryChatStorage) GetChatByID(chatID int64) (*core.Chat, error)

GetChatByID is a core.IChatStorage interface implementation

type InMemoryUserStorage

type InMemoryUserStorage struct {
	// contains filtered or unexported fields
}

func (*InMemoryUserStorage) CreateUser

func (storage *InMemoryUserStorage) CreateUser(user *core.User) error

CreateUser is a core.IUserStorage interface implementation

func (*InMemoryUserStorage) GetUserById

func (storage *InMemoryUserStorage) GetUserById(userID int64) (*core.User, error)

GetUserById is a core.IUserStorage interface implementation

type MathRand

type MathRand struct{}

func (MathRand) GetRand

func (MathRand) GetRand(n int) int

type OutlineStorage

type OutlineStorage struct {
	// contains filtered or unexported fields
}

func CreateOutlineStorage

func CreateOutlineStorage(dbFile string, l core.ILogger) *OutlineStorage

CreateOutlineStorage is a default OutlineStorage factory

func (*OutlineStorage) CreateKey

func (storage *OutlineStorage) CreateKey(id string, chatID int64, host string, title string, key string) error

func (*OutlineStorage) DeleteKey

func (storage *OutlineStorage) DeleteKey(key *core.VpnKey, host string) error

func (*OutlineStorage) GetKeys

func (storage *OutlineStorage) GetKeys(chatID int64) ([]*VpnKey, error)

type Player

type Player struct {
	GameID       int64 `gorm:"primaryKey"`
	UserID       int64 `gorm:"primaryKey"`
	FirstName    string
	LastName     string
	Username     string
	LanguageCode string
}

Player that can be persistent on disk

func (Player) TableName

func (Player) TableName() string

TableName gorm API

type RabbitFactory

type RabbitFactory struct {
	// contains filtered or unexported fields
}

func (*RabbitFactory) Close

func (q *RabbitFactory) Close()

func (*RabbitFactory) NewTask

func (q *RabbitFactory) NewTask(name string) core.ITask

NewTask is a core.ITaskFactory interface implementation

type RabbitWorker

type RabbitWorker struct {
	// contains filtered or unexported fields
}

func (*RabbitWorker) Perform

func (worker *RabbitWorker) Perform(data []byte, ch chan []byte) error

type Round

type Round struct {
	GameID   int64
	UserID   int64
	Day      string `gorm:"primaryKey"`
	Username string
}

Round that can be persistent on disk

func (Round) TableName

func (Round) TableName() string

TableName gorm API

type Settings

type Settings struct {
	ChatID    int64  `gorm:"primaryKey"`
	Key       string `gorm:"primaryKey"`
	Data      []byte
	CreatedAt time.Time `gorm:"autoUpdateTime"`
	UpdatedAt time.Time `gorm:"autoCreateTime"`
}

Settings

type SettingsStorage

type SettingsStorage struct {
	// contains filtered or unexported fields
}

SettingsStorage implements core.ISettingsProvider interface

func (*SettingsStorage) GetData

func (storage *SettingsStorage) GetData(chatID core.ChatID, key core.SettingKey) ([]byte, error)

GetData is a core.ISettingsProvider interface implementation

func (*SettingsStorage) SetData

func (storage *SettingsStorage) SetData(chatID core.ChatID, key core.SettingKey, data []byte) error

SetData is a core.ISettingsProvider interface implementation

type User

type User struct {
	UserID       int64 `gorm:"primaryKey"`
	FirstName    string
	LastName     string
	Username     string
	LanguageCode string
	CreatedAt    time.Time `gorm:"autoUpdateTime"`
	UpdatedAt    time.Time `gorm:"autoCreateTime"`
}

User

type UserStorage

type UserStorage struct {
	// contains filtered or unexported fields
}

func (*UserStorage) CreateUser

func (storage *UserStorage) CreateUser(user *core.User) error

CreateUser is a core.IUserStorage interface implementation

func (*UserStorage) GetUserById

func (storage *UserStorage) GetUserById(userID int64) (*core.User, error)

GetUserById is a core.IUserStorage interface implementation

type VpnKey

type VpnKey struct {
	ID        string `gorm:"primaryKey"`
	ChatID    int64  `gorm:"primaryKey"`
	Host      string `gorm:"primaryKey"`
	Title     string
	Key       string
	CreatedAt time.Time `gorm:"autoUpdateTime"`
	UpdatedAt time.Time `gorm:"autoCreateTime"`
}

type VpnLocalizer

type VpnLocalizer struct {
	// contains filtered or unexported fields
}

VpnLocalizer for faggot game

func CreateVpnLocalizer

func CreateVpnLocalizer() *VpnLocalizer

func (*VpnLocalizer) AllKeys

func (l *VpnLocalizer) AllKeys() []string

AllKeys is a core.ILocalizer implementation

func (*VpnLocalizer) I18n

func (l *VpnLocalizer) I18n(lang, key string, args ...interface{}) string

I18n is a core.ILocalizer implementation

Jump to

Keyboard shortcuts

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