pgsql

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string `yaml:"host"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	PoolSize int    `yaml:"pool_size"`
	SSLMode  string `yaml:"ssl_mode"`
}

Config represents PostgreSQL storage configuration.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface

type Storage

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

Storage represents a SQL storage sub system.

func New

func New(c *Config) *Storage

New instantiates a PostgreSQL storage instance.

func (*Storage) Close

func (s *Storage) Close() error

Close shuts down SQL storage sub system.

func (*Storage) CountOfflineMessages

func (s *Storage) CountOfflineMessages(ctx context.Context, username string) (int, error)

CountOfflineMessages returns current length of user's offline queue.

func (*Storage) DeleteBlockListItem added in v0.7.0

func (s *Storage) DeleteBlockListItem(ctx context.Context, item *model.BlockListItem) error

DeleteBlockListItem deletes a block list item entity from storage.

func (*Storage) DeleteNode added in v0.7.0

func (s *Storage) DeleteNode(ctx context.Context, host, name string) error

func (*Storage) DeleteNodeAffiliation added in v0.7.0

func (s *Storage) DeleteNodeAffiliation(ctx context.Context, jid, host, name string) error

func (*Storage) DeleteNodeSubscription added in v0.7.0

func (s *Storage) DeleteNodeSubscription(ctx context.Context, jid, host, name string) error

func (*Storage) DeleteOfflineMessages

func (s *Storage) DeleteOfflineMessages(ctx context.Context, username string) error

DeleteOfflineMessages clears a user offline queue.

func (*Storage) DeleteRosterItem

func (s *Storage) DeleteRosterItem(ctx context.Context, username, jid string) (rostermodel.Version, error)

DeleteRosterItem deletes a roster item entity from storage.

func (*Storage) DeleteRosterNotification

func (s *Storage) DeleteRosterNotification(ctx context.Context, contact, jid string) error

DeleteRosterNotification deletes a roster notification entity from storage.

func (*Storage) DeleteUser

func (s *Storage) DeleteUser(ctx context.Context, username string) error

DeleteUser deletes a user entity from storage.

func (*Storage) FetchBlockListItems

func (s *Storage) FetchBlockListItems(ctx context.Context, username string) ([]model.BlockListItem, error)

FetchBlockListItems retrieves from storage all block list item entities associated to a given user.

func (*Storage) FetchCapabilities added in v0.7.0

func (s *Storage) FetchCapabilities(ctx context.Context, node, ver string) (*model.Capabilities, error)

func (*Storage) FetchHosts added in v0.7.0

func (s *Storage) FetchHosts(ctx context.Context) ([]string, error)

func (*Storage) FetchNode added in v0.7.0

func (s *Storage) FetchNode(ctx context.Context, host, name string) (*pubsubmodel.Node, error)

func (*Storage) FetchNodeAffiliation added in v0.7.0

func (s *Storage) FetchNodeAffiliation(ctx context.Context, host, name, jid string) (*pubsubmodel.Affiliation, error)

func (*Storage) FetchNodeAffiliations added in v0.7.0

func (s *Storage) FetchNodeAffiliations(ctx context.Context, host, name string) ([]pubsubmodel.Affiliation, error)

func (*Storage) FetchNodeItems added in v0.7.0

func (s *Storage) FetchNodeItems(ctx context.Context, host, name string) ([]pubsubmodel.Item, error)

func (*Storage) FetchNodeItemsWithIDs added in v0.7.0

func (s *Storage) FetchNodeItemsWithIDs(ctx context.Context, host, name string, identifiers []string) ([]pubsubmodel.Item, error)

func (*Storage) FetchNodeLastItem added in v0.7.0

func (s *Storage) FetchNodeLastItem(ctx context.Context, host, name string) (*pubsubmodel.Item, error)

func (*Storage) FetchNodeSubscriptions added in v0.7.0

func (s *Storage) FetchNodeSubscriptions(ctx context.Context, host, name string) ([]pubsubmodel.Subscription, error)

func (*Storage) FetchNodes added in v0.7.0

func (s *Storage) FetchNodes(ctx context.Context, host string) ([]pubsubmodel.Node, error)

func (*Storage) FetchOfflineMessages

func (s *Storage) FetchOfflineMessages(ctx context.Context, username string) ([]xmpp.Message, error)

FetchOfflineMessages retrieves from storage current user offline queue.

func (*Storage) FetchPrivateXML

func (s *Storage) FetchPrivateXML(ctx context.Context, namespace string, username string) ([]xmpp.XElement, error)

FetchPrivateXML retrieves from storage a private element.

func (*Storage) FetchRosterGroups added in v0.7.0

func (s *Storage) FetchRosterGroups(ctx context.Context, username string) ([]string, error)

FetchRosterGroups retrieves all groups associated to a user roster

func (*Storage) FetchRosterItem

func (s *Storage) FetchRosterItem(ctx context.Context, username, jid string) (*rostermodel.Item, error)

FetchRosterItem retrieves from storage a roster item entity.

func (*Storage) FetchRosterItems

func (s *Storage) FetchRosterItems(ctx context.Context, username string) ([]rostermodel.Item, rostermodel.Version, error)

FetchRosterItems retrieves from storage all roster item entities associated to a given user.

func (*Storage) FetchRosterItemsInGroups added in v0.4.10

func (s *Storage) FetchRosterItemsInGroups(ctx context.Context, username string, groups []string) ([]rostermodel.Item, rostermodel.Version, error)

FetchRosterItemsInGroups retrieves from storage all roster item entities associated to a given user and a set of groups.

func (*Storage) FetchRosterNotification

func (s *Storage) FetchRosterNotification(ctx context.Context, contact string, jid string) (*rostermodel.Notification, error)

FetchRosterNotification retrieves from storage a roster notification entity.

func (*Storage) FetchRosterNotifications

func (s *Storage) FetchRosterNotifications(ctx context.Context, contact string) ([]rostermodel.Notification, error)

FetchRosterNotifications retrieves from storage all roster notifications associated to a given user.

func (*Storage) FetchSubscribedNodes added in v0.7.0

func (s *Storage) FetchSubscribedNodes(ctx context.Context, jid string) ([]pubsubmodel.Node, error)

func (*Storage) FetchUser

func (s *Storage) FetchUser(ctx context.Context, username string) (*model.User, error)

FetchUser retrieves from storage a user entity.

func (*Storage) FetchVCard

func (s *Storage) FetchVCard(ctx context.Context, username string) (xmpp.XElement, error)

FetchVCard retrieves from storage a vCard element associated to a given user.

func (*Storage) InsertBlockListItem added in v0.7.0

func (s *Storage) InsertBlockListItem(ctx context.Context, item *model.BlockListItem) error

InsertBlockListItem inserts a block list item entity into storage, only in case they haven't been previously inserted.

func (*Storage) InsertCapabilities added in v0.7.0

func (s *Storage) InsertCapabilities(ctx context.Context, caps *model.Capabilities) error

func (*Storage) InsertOfflineMessage

func (s *Storage) InsertOfflineMessage(ctx context.Context, message *xmpp.Message, username string) error

InsertOfflineMessage inserts a new message element into user's offline queue.

func (*Storage) IsClusterCompatible

func (s *Storage) IsClusterCompatible() bool

IsClusterCompatible returns whether or not the underlying storage subsystem can be used in cluster mode.

func (*Storage) UpsertNode added in v0.7.0

func (s *Storage) UpsertNode(ctx context.Context, node *pubsubmodel.Node) error

func (*Storage) UpsertNodeAffiliation added in v0.7.0

func (s *Storage) UpsertNodeAffiliation(ctx context.Context, affiliation *pubsubmodel.Affiliation, host, name string) error

func (*Storage) UpsertNodeItem added in v0.7.0

func (s *Storage) UpsertNodeItem(ctx context.Context, item *pubsubmodel.Item, host, name string, maxNodeItems int) error

func (*Storage) UpsertNodeSubscription added in v0.7.0

func (s *Storage) UpsertNodeSubscription(ctx context.Context, subscription *pubsubmodel.Subscription, host, name string) error

func (*Storage) UpsertPrivateXML added in v0.7.0

func (s *Storage) UpsertPrivateXML(ctx context.Context, privateXML []xmpp.XElement, namespace string, username string) error

UpsertPrivateXML inserts a new private element into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertRosterItem added in v0.7.0

func (s *Storage) UpsertRosterItem(ctx context.Context, ri *rostermodel.Item) (rostermodel.Version, error)

UpsertRosterItem inserts a new roster item entity into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertRosterNotification added in v0.7.0

func (s *Storage) UpsertRosterNotification(ctx context.Context, rn *rostermodel.Notification) error

UpsertRosterNotification inserts a new roster notification entity into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertUser added in v0.7.0

func (s *Storage) UpsertUser(ctx context.Context, u *model.User) error

UpsertUser inserts a new user entity into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertVCard added in v0.7.0

func (s *Storage) UpsertVCard(ctx context.Context, vCard xmpp.XElement, username string) error

UpsertVCard inserts a new vCard element into storage, or updates it in case it's been previously inserted.

func (*Storage) UserExists

func (s *Storage) UserExists(ctx context.Context, username string) (bool, error)

UserExists returns whether or not a user exists within storage.

Jump to

Keyboard shortcuts

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