Documentation
¶
Index ¶
- func BroadcastAddr(n *net.IPNet) net.IP
- func ByteCountSI(b int64) string
- func FormatDateHTML(t *time.Time) string
- func GetDatabaseForConfig(cfg *DatabaseConfig) (db *gorm.DB, err error)
- func IncreaseIP(ip net.IP)
- func IsIPv6(address string) bool
- func ListContains(lst []string, needle string) bool
- func ListToString(lst []string) string
- func MigrateDatabase(db *gorm.DB, version string) error
- func ParseStringList(lst string) []string
- func SendEmailWithAttachments(cfg MailConfig, sender, replyTo, subject, body, htmlBody string, ...) error
- type DatabaseConfig
- type DatabaseMigrationInfo
- type MailAttachment
- type MailAuthType
- type MailConfig
- type MailEncryption
- type Migration
- type SupportedDatabase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastAddr ¶
BroadcastAddr returns the last address in the given network, or the broadcast address.
func FormatDateHTML ¶ added in v1.0.16
func GetDatabaseForConfig ¶ added in v1.0.4
func GetDatabaseForConfig(cfg *DatabaseConfig) (db *gorm.DB, err error)
func ListContains ¶ added in v1.0.4
ListContains checks if a needle exists in the given list.
func ListToString ¶
ListToString converts a list of strings into a comma separated string.
func ParseStringList ¶
ParseStringList converts a comma separated string into a list of strings. It also trims spaces from each element of the list.
func SendEmailWithAttachments ¶
func SendEmailWithAttachments(cfg MailConfig, sender, replyTo, subject, body, htmlBody string, receivers []string, attachments []MailAttachment) error
SendEmailWithAttachments sends a mail with optional attachments.
Types ¶
type DatabaseConfig ¶ added in v1.0.4
type DatabaseConfig struct { Typ SupportedDatabase `yaml:"typ" envconfig:"DATABASE_TYPE"` //mysql or sqlite Host string `yaml:"host" envconfig:"DATABASE_HOST"` Port int `yaml:"port" envconfig:"DATABASE_PORT"` Database string `yaml:"database" envconfig:"DATABASE_NAME"` // On SQLite: the database file-path, otherwise the database name User string `yaml:"user" envconfig:"DATABASE_USERNAME"` Password string `yaml:"password" envconfig:"DATABASE_PASSWORD"` }
type DatabaseMigrationInfo ¶ added in v1.0.5
type MailAttachment ¶
type MailAuthType ¶ added in v1.0.8
type MailAuthType string
const ( MailAuthPlain MailAuthType = "plain" MailAuthLogin MailAuthType = "login" MailAuthCramMD5 MailAuthType = "crammd5" )
type MailConfig ¶
type MailConfig struct { Host string `yaml:"host" envconfig:"EMAIL_HOST"` Port int `yaml:"port" envconfig:"EMAIL_PORT"` TLS bool `yaml:"tls" envconfig:"EMAIL_TLS"` // Deprecated, use MailConfig.Encryption instead. Encryption MailEncryption `yaml:"encryption" envconfig:"EMAIL_ENCRYPTION"` CertValidation bool `yaml:"certcheck" envconfig:"EMAIL_CERT_VALIDATION"` Username string `yaml:"user" envconfig:"EMAIL_USERNAME"` Password string `yaml:"pass" envconfig:"EMAIL_PASSWORD"` AuthType MailAuthType `yaml:"auth" envconfig:"EMAIL_AUTHTYPE"` }
type MailEncryption ¶ added in v1.0.8
type MailEncryption string
const ( MailEncryptionNone MailEncryption = "none" MailEncryptionTLS MailEncryption = "tls" MailEncryptionStartTLS MailEncryption = "starttls" )
type Migration ¶ added in v1.0.8
type Migration struct {
// contains filtered or unexported fields
}
type SupportedDatabase ¶ added in v1.0.4
type SupportedDatabase string
const ( SupportedDatabaseMySQL SupportedDatabase = "mysql" SupportedDatabaseSQLite SupportedDatabase = "sqlite" )
Click to show internal directories.
Click to hide internal directories.