Documentation ¶
Index ¶
- Constants
- Variables
- func CleanPublicURL(url string) string
- func CreateDatabaseIfNotExist(cfg DatabaseConfig) error
- func CurrentTimestamp() time.Time
- func DecodeImageAndFixOrientation(reader io.Reader, orientation string) (image.Image, error)
- func GenerateRSAKey() ([]byte, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateUUID() string
- func GetImageOrientation(reader io.Reader) string
- func LoadRSAKey(settingRepo SettingRepo, keyPath string) (string, error)
- func NullTimeToRPCString(t sql.NullTime) string
- func OpenDatabase(cfg DatabaseConfig, ...) (db *sqlx.DB, migrationsCount int, err error)
- func ParseTemplates(templatesDir embed.FS, rootDir string) (*template.Template, error)
- func RPCStringToTime(s string) (time.Time, error)
- func RSAKeysFromPrivateKeyContent(privateKeyContent string) (privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, publicKeyPEM []byte, ...)
- func RunInTransaction(db *sqlx.DB, action func(tx *sqlx.Tx) error) error
- func TimeToRPCString(t time.Time) string
- func VideoThumbnail(videoPath string) ([]byte, error)
- type Container
- type DatabaseConfig
- type MailAttachment
- type MailAttachmentList
- type MailSender
- type Notification
- type NotificationRepo
- type S3Cleaner
- type S3Config
- type S3Storage
- func (s *S3Storage) CreateLink(ctx context.Context, blobID string, expiration time.Duration) (string, error)
- func (s *S3Storage) CreateUploadLink(ctx context.Context, blobID, contentType string, metadata map[string]string) (uploadLink string, formData map[string]string, err error)
- func (s *S3Storage) Exists(ctx context.Context, blobID string) (bool, error)
- func (s *S3Storage) PutObject(ctx context.Context, blobID string, content []byte, contentType string) error
- func (s *S3Storage) Read(ctx context.Context, blobID string, w io.Writer) error
- func (s *S3Storage) ReadN(ctx context.Context, blobID string, n int) ([]byte, error)
- func (s *S3Storage) RemoveObject(ctx context.Context, blobID string) error
- type SMTPConfig
- type Setting
- type SettingRepo
Constants ¶
View Source
const (
MasterDBName = "postgres"
)
Variables ¶
View Source
var (
ErrDatabaseNameIsEmpty = merry.New("database name should be specified")
)
Functions ¶
func CleanPublicURL ¶
func CreateDatabaseIfNotExist ¶
func CreateDatabaseIfNotExist(cfg DatabaseConfig) error
func CurrentTimestamp ¶
func GenerateRSAKey ¶
func GenerateRandomBytes ¶
func GenerateUUID ¶
func GenerateUUID() string
func GetImageOrientation ¶
func LoadRSAKey ¶
func LoadRSAKey(settingRepo SettingRepo, keyPath string) (string, error)
func NullTimeToRPCString ¶
func OpenDatabase ¶
func ParseTemplates ¶
func TimeToRPCString ¶
func VideoThumbnail ¶
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func (Container) ImageCreated ¶
type DatabaseConfig ¶
type DatabaseConfig struct { Host string `yaml:"host" required:"true" env:"KOTO_DB_HOST"` Port int `yaml:"port" default:"5432" env:"KOTO_DB_PORT"` SSLMode string `yaml:"ssl_mode" env:"KOTO_DB_SSL_MODE"` DBName string `yaml:"db_name" required:"true" env:"KOTO_DB_NAME"` User string `yaml:"user" required:"true" env:"KOTO_DB_USER"` Password string `yaml:"password" required:"true" env:"KOTO_DB_PASSWORD"` }
func (DatabaseConfig) ConnectionString ¶
func (cfg DatabaseConfig) ConnectionString() string
type MailAttachment ¶
func (MailAttachment) InlineHTML ¶
func (ma MailAttachment) InlineHTML() string
type MailAttachmentList ¶
type MailAttachmentList map[string]MailAttachment
func (MailAttachmentList) InlineHTML ¶
func (ma MailAttachmentList) InlineHTML(key string) string
type MailSender ¶
type MailSender struct {
// contains filtered or unexported fields
}
func NewMailSender ¶
func NewMailSender(cfg SMTPConfig) *MailSender
func (*MailSender) Enabled ¶
func (m *MailSender) Enabled() bool
func (*MailSender) SendHTMLEmail ¶
func (m *MailSender) SendHTMLEmail(recipients []string, subject string, message string, attachments MailAttachmentList) error
func (*MailSender) SendTextEmail ¶
func (m *MailSender) SendTextEmail(recipients []string, subject string, message string) error
type Notification ¶
type NotificationRepo ¶
type NotificationRepo interface { AddNotifications(userIDs []string, text, notificationType string, data map[string]interface{}) error Counts(userID string) (total int, unread int, err error) Notifications(userID string) ([]Notification, error) Clean(userID string, lastKnownID string) error MarkRead(userID string, lastKnownID string) error DeleteUserNotifications(tx *sqlx.Tx, userID string) error }
func NewNotifications ¶
func NewNotifications(db *sqlx.DB) NotificationRepo
type S3Config ¶
type S3Config struct { Endpoint string `yaml:"endpoint" required:"true" env:"KOTO_S3_ENDPOINT"` ExternalEndpoint string `yaml:"external_endpoint" required:"false" env:"KOTO_S3_EXTERNAL_ENDPOINT"` Region string `yaml:"region" env:"KOTO_S3_REGION"` Key string `yaml:"key" required:"true" env:"KOTO_S3_KEY"` Secret string `yaml:"secret" required:"true" env:"KOTO_S3_SECRET"` Bucket string `yaml:"bucket" required:"true" env:"KOTO_S3_BUCKET"` }
func (S3Config) CreateStorage ¶
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
func NewS3Storage ¶
func (*S3Storage) CreateLink ¶
func (*S3Storage) CreateUploadLink ¶
type SMTPConfig ¶
type SettingRepo ¶
func NewSettings ¶
func NewSettings(db *sqlx.DB) SettingRepo
Click to show internal directories.
Click to hide internal directories.