Documentation ¶
Index ¶
- Constants
- func GetNick(user *User, net *Network) string
- func GetRealname(user *User, net *Network) string
- func GetUsername(user *User, net *Network) string
- type Channel
- type Database
- type DatabaseStats
- type DeliveryReceipt
- type MessageFilter
- type MessageOptions
- type MessageTarget
- type MetricsCollectorDatabase
- type Network
- type PostgresDB
- func (db *PostgresDB) Close() error
- func (db *PostgresDB) DeleteChannel(ctx context.Context, id int64) error
- func (db *PostgresDB) DeleteNetwork(ctx context.Context, id int64) error
- func (db *PostgresDB) DeleteUser(ctx context.Context, id int64) error
- func (db *PostgresDB) DeleteWebPushSubscription(ctx context.Context, id int64) error
- func (db *PostgresDB) GetMessageLastID(ctx context.Context, networkID int64, name string) (int64, error)
- func (db *PostgresDB) GetReadReceipt(ctx context.Context, networkID int64, name string) (*ReadReceipt, error)
- func (db *PostgresDB) GetUser(ctx context.Context, username string) (*User, error)
- func (db *PostgresDB) ListChannels(ctx context.Context, networkID int64) ([]Channel, error)
- func (db *PostgresDB) ListDeliveryReceipts(ctx context.Context, networkID int64) ([]DeliveryReceipt, error)
- func (db *PostgresDB) ListInactiveUsernames(ctx context.Context, limit time.Time) ([]string, error)
- func (db *PostgresDB) ListMessageLastPerTarget(ctx context.Context, networkID int64, options *MessageOptions) ([]MessageTarget, error)
- func (db *PostgresDB) ListMessages(ctx context.Context, networkID int64, name string, options *MessageOptions) ([]*irc.Message, error)
- func (db *PostgresDB) ListNetworks(ctx context.Context, userID int64) ([]Network, error)
- func (db *PostgresDB) ListUsers(ctx context.Context) ([]User, error)
- func (db *PostgresDB) ListWebPushConfigs(ctx context.Context) ([]WebPushConfig, error)
- func (db *PostgresDB) ListWebPushSubscriptions(ctx context.Context, userID, networkID int64) ([]WebPushSubscription, error)
- func (db *PostgresDB) RegisterMetrics(r prometheus.Registerer) error
- func (db *PostgresDB) Stats(ctx context.Context) (*DatabaseStats, error)
- func (db *PostgresDB) StoreChannel(ctx context.Context, networkID int64, ch *Channel) error
- func (db *PostgresDB) StoreClientDeliveryReceipts(ctx context.Context, networkID int64, client string, ...) error
- func (db *PostgresDB) StoreMessages(ctx context.Context, networkID int64, name string, msgs []*irc.Message) ([]int64, error)
- func (db *PostgresDB) StoreNetwork(ctx context.Context, userID int64, network *Network) error
- func (db *PostgresDB) StoreReadReceipt(ctx context.Context, networkID int64, receipt *ReadReceipt) error
- func (db *PostgresDB) StoreUser(ctx context.Context, user *User) error
- func (db *PostgresDB) StoreWebPushConfig(ctx context.Context, config *WebPushConfig) error
- func (db *PostgresDB) StoreWebPushSubscription(ctx context.Context, userID, networkID int64, sub *WebPushSubscription) error
- type ReadReceipt
- type SASL
- type SqliteDB
- func (db *SqliteDB) Close() error
- func (db *SqliteDB) DeleteChannel(ctx context.Context, id int64) error
- func (db *SqliteDB) DeleteNetwork(ctx context.Context, id int64) error
- func (db *SqliteDB) DeleteUser(ctx context.Context, id int64) error
- func (db *SqliteDB) DeleteWebPushSubscription(ctx context.Context, id int64) error
- func (db *SqliteDB) GetMessageLastID(ctx context.Context, networkID int64, name string) (int64, error)
- func (db *SqliteDB) GetReadReceipt(ctx context.Context, networkID int64, name string) (*ReadReceipt, error)
- func (db *SqliteDB) GetUser(ctx context.Context, username string) (*User, error)
- func (db *SqliteDB) ListChannels(ctx context.Context, networkID int64) ([]Channel, error)
- func (db *SqliteDB) ListDeliveryReceipts(ctx context.Context, networkID int64) ([]DeliveryReceipt, error)
- func (db *SqliteDB) ListInactiveUsernames(ctx context.Context, limit time.Time) ([]string, error)
- func (db *SqliteDB) ListMessageLastPerTarget(ctx context.Context, networkID int64, options *MessageOptions) ([]MessageTarget, error)
- func (db *SqliteDB) ListMessages(ctx context.Context, networkID int64, name string, options *MessageOptions) ([]*irc.Message, error)
- func (db *SqliteDB) ListNetworks(ctx context.Context, userID int64) ([]Network, error)
- func (db *SqliteDB) ListUsers(ctx context.Context) ([]User, error)
- func (db *SqliteDB) ListWebPushConfigs(ctx context.Context) ([]WebPushConfig, error)
- func (db *SqliteDB) ListWebPushSubscriptions(ctx context.Context, userID, networkID int64) ([]WebPushSubscription, error)
- func (db *SqliteDB) RegisterMetrics(r prometheus.Registerer) error
- func (db *SqliteDB) Stats(ctx context.Context) (*DatabaseStats, error)
- func (db *SqliteDB) StoreChannel(ctx context.Context, networkID int64, ch *Channel) error
- func (db *SqliteDB) StoreClientDeliveryReceipts(ctx context.Context, networkID int64, client string, ...) error
- func (db *SqliteDB) StoreMessages(ctx context.Context, networkID int64, name string, msgs []*irc.Message) ([]int64, error)
- func (db *SqliteDB) StoreNetwork(ctx context.Context, userID int64, network *Network) error
- func (db *SqliteDB) StoreReadReceipt(ctx context.Context, networkID int64, receipt *ReadReceipt) error
- func (db *SqliteDB) StoreUser(ctx context.Context, user *User) error
- func (db *SqliteDB) StoreWebPushConfig(ctx context.Context, config *WebPushConfig) error
- func (db *SqliteDB) StoreWebPushSubscription(ctx context.Context, userID, networkID int64, sub *WebPushSubscription) error
- type User
- type WebPushConfig
- type WebPushSubscription
Constants ¶
View Source
const SqliteEnabled = true
Variables ¶
This section is empty.
Functions ¶
func GetRealname ¶
func GetUsername ¶
Types ¶
type Channel ¶
type Channel struct { ID int64 Name string Key string Detached bool DetachedInternalMsgID string RelayDetached MessageFilter ReattachOn MessageFilter DetachAfter time.Duration DetachOn MessageFilter }
type Database ¶
type Database interface { Close() error Stats(ctx context.Context) (*DatabaseStats, error) ListUsers(ctx context.Context) ([]User, error) GetUser(ctx context.Context, username string) (*User, error) StoreUser(ctx context.Context, user *User) error DeleteUser(ctx context.Context, id int64) error ListInactiveUsernames(ctx context.Context, limit time.Time) ([]string, error) ListNetworks(ctx context.Context, userID int64) ([]Network, error) StoreNetwork(ctx context.Context, userID int64, network *Network) error DeleteNetwork(ctx context.Context, id int64) error ListChannels(ctx context.Context, networkID int64) ([]Channel, error) StoreChannel(ctx context.Context, networKID int64, ch *Channel) error DeleteChannel(ctx context.Context, id int64) error ListDeliveryReceipts(ctx context.Context, networkID int64) ([]DeliveryReceipt, error) StoreClientDeliveryReceipts(ctx context.Context, networkID int64, client string, receipts []DeliveryReceipt) error GetReadReceipt(ctx context.Context, networkID int64, name string) (*ReadReceipt, error) StoreReadReceipt(ctx context.Context, networkID int64, receipt *ReadReceipt) error ListWebPushConfigs(ctx context.Context) ([]WebPushConfig, error) StoreWebPushConfig(ctx context.Context, config *WebPushConfig) error ListWebPushSubscriptions(ctx context.Context, userID, networkID int64) ([]WebPushSubscription, error) StoreWebPushSubscription(ctx context.Context, userID, networkID int64, sub *WebPushSubscription) error DeleteWebPushSubscription(ctx context.Context, id int64) error GetMessageLastID(ctx context.Context, networkID int64, name string) (int64, error) StoreMessages(ctx context.Context, networkID int64, name string, msgs []*irc.Message) ([]int64, error) ListMessageLastPerTarget(ctx context.Context, networkID int64, options *MessageOptions) ([]MessageTarget, error) ListMessages(ctx context.Context, networkID int64, name string, options *MessageOptions) ([]*irc.Message, error) }
func OpenPostgresDB ¶
func OpenSqliteDB ¶
func OpenTempPostgresDB ¶
func OpenTempSqliteDB ¶
type DatabaseStats ¶
type DeliveryReceipt ¶
type MessageFilter ¶
type MessageFilter int
const ( // TODO: use customizable user defaults for FilterDefault FilterDefault MessageFilter = iota FilterNone FilterHighlight FilterMessage )
type MessageOptions ¶
type MessageTarget ¶
type MetricsCollectorDatabase ¶
type MetricsCollectorDatabase interface { Database RegisterMetrics(r prometheus.Registerer) error }
type Network ¶
type Network struct { ID int64 Name string Addr string Nick string Username string Realname string Pass string ConnectCommands []string CertFP string SASL SASL AutoAway bool Enabled bool }
func NewNetwork ¶
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
func (*PostgresDB) Close ¶
func (db *PostgresDB) Close() error
func (*PostgresDB) DeleteChannel ¶
func (db *PostgresDB) DeleteChannel(ctx context.Context, id int64) error
func (*PostgresDB) DeleteNetwork ¶
func (db *PostgresDB) DeleteNetwork(ctx context.Context, id int64) error
func (*PostgresDB) DeleteUser ¶
func (db *PostgresDB) DeleteUser(ctx context.Context, id int64) error
func (*PostgresDB) DeleteWebPushSubscription ¶
func (db *PostgresDB) DeleteWebPushSubscription(ctx context.Context, id int64) error
func (*PostgresDB) GetMessageLastID ¶
func (*PostgresDB) GetReadReceipt ¶
func (db *PostgresDB) GetReadReceipt(ctx context.Context, networkID int64, name string) (*ReadReceipt, error)
func (*PostgresDB) ListChannels ¶
func (*PostgresDB) ListDeliveryReceipts ¶
func (db *PostgresDB) ListDeliveryReceipts(ctx context.Context, networkID int64) ([]DeliveryReceipt, error)
func (*PostgresDB) ListInactiveUsernames ¶
func (*PostgresDB) ListMessageLastPerTarget ¶
func (db *PostgresDB) ListMessageLastPerTarget(ctx context.Context, networkID int64, options *MessageOptions) ([]MessageTarget, error)
func (*PostgresDB) ListMessages ¶
func (db *PostgresDB) ListMessages(ctx context.Context, networkID int64, name string, options *MessageOptions) ([]*irc.Message, error)
func (*PostgresDB) ListNetworks ¶
func (*PostgresDB) ListWebPushConfigs ¶
func (db *PostgresDB) ListWebPushConfigs(ctx context.Context) ([]WebPushConfig, error)
func (*PostgresDB) ListWebPushSubscriptions ¶
func (db *PostgresDB) ListWebPushSubscriptions(ctx context.Context, userID, networkID int64) ([]WebPushSubscription, error)
func (*PostgresDB) RegisterMetrics ¶
func (db *PostgresDB) RegisterMetrics(r prometheus.Registerer) error
func (*PostgresDB) Stats ¶
func (db *PostgresDB) Stats(ctx context.Context) (*DatabaseStats, error)
func (*PostgresDB) StoreChannel ¶
func (*PostgresDB) StoreClientDeliveryReceipts ¶
func (db *PostgresDB) StoreClientDeliveryReceipts(ctx context.Context, networkID int64, client string, receipts []DeliveryReceipt) error
func (*PostgresDB) StoreMessages ¶
func (*PostgresDB) StoreNetwork ¶
func (*PostgresDB) StoreReadReceipt ¶
func (db *PostgresDB) StoreReadReceipt(ctx context.Context, networkID int64, receipt *ReadReceipt) error
func (*PostgresDB) StoreUser ¶
func (db *PostgresDB) StoreUser(ctx context.Context, user *User) error
func (*PostgresDB) StoreWebPushConfig ¶
func (db *PostgresDB) StoreWebPushConfig(ctx context.Context, config *WebPushConfig) error
func (*PostgresDB) StoreWebPushSubscription ¶
func (db *PostgresDB) StoreWebPushSubscription(ctx context.Context, userID, networkID int64, sub *WebPushSubscription) error
type ReadReceipt ¶
type SqliteDB ¶
type SqliteDB struct {
// contains filtered or unexported fields
}
func (*SqliteDB) DeleteChannel ¶
func (*SqliteDB) DeleteNetwork ¶
func (*SqliteDB) DeleteWebPushSubscription ¶
func (*SqliteDB) GetMessageLastID ¶
func (*SqliteDB) GetReadReceipt ¶
func (*SqliteDB) ListChannels ¶
func (*SqliteDB) ListDeliveryReceipts ¶
func (*SqliteDB) ListInactiveUsernames ¶
func (*SqliteDB) ListMessageLastPerTarget ¶
func (db *SqliteDB) ListMessageLastPerTarget(ctx context.Context, networkID int64, options *MessageOptions) ([]MessageTarget, error)
func (*SqliteDB) ListMessages ¶
func (*SqliteDB) ListNetworks ¶
func (*SqliteDB) ListWebPushConfigs ¶
func (db *SqliteDB) ListWebPushConfigs(ctx context.Context) ([]WebPushConfig, error)
func (*SqliteDB) ListWebPushSubscriptions ¶
func (*SqliteDB) RegisterMetrics ¶
func (db *SqliteDB) RegisterMetrics(r prometheus.Registerer) error
func (*SqliteDB) StoreChannel ¶
func (*SqliteDB) StoreClientDeliveryReceipts ¶
func (*SqliteDB) StoreMessages ¶
func (*SqliteDB) StoreNetwork ¶
func (*SqliteDB) StoreReadReceipt ¶
func (*SqliteDB) StoreWebPushConfig ¶
func (db *SqliteDB) StoreWebPushConfig(ctx context.Context, config *WebPushConfig) error
func (*SqliteDB) StoreWebPushSubscription ¶
type User ¶
type User struct { ID int64 Username string Password string // hashed Nick string Realname string Admin bool Enabled bool DownstreamInteractedAt time.Time }
func (*User) CheckPassword ¶
func (*User) SetPassword ¶
type WebPushConfig ¶
Click to show internal directories.
Click to hide internal directories.