Documentation
¶
Overview ¶
Package sql provides a shared SQL storage implementation for xmpp-go.
Index ¶
- func Migrate(ctx context.Context, db *sql.DB, dialect Dialect) error
- type Dialect
- type Store
- func (s *Store) BlockingStore() storage.BlockingStore
- func (s *Store) BookmarkStore() storage.BookmarkStore
- func (s *Store) Close() error
- func (s *Store) Init(ctx context.Context) error
- func (s *Store) MAMStore() storage.MAMStore
- func (s *Store) MUCRoomStore() storage.MUCRoomStore
- func (s *Store) OfflineStore() storage.OfflineStore
- func (s *Store) PubSubStore() storage.PubSubStore
- func (s *Store) RosterStore() storage.RosterStore
- func (s *Store) UserStore() storage.UserStore
- func (s *Store) VCardStore() storage.VCardStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dialect ¶
type Dialect interface {
// Name returns the dialect name (e.g. "sqlite", "postgres", "mysql").
Name() string
// Placeholder returns the parameter placeholder for the nth parameter (1-indexed).
// e.g. SQLite/MySQL return "?", PostgreSQL returns "$1", "$2", etc.
Placeholder(n int) string
// AutoIncrement returns the column type for an auto-incrementing primary key.
AutoIncrement() string
// Migrations returns the SQL migration statements for this dialect.
Migrations() []string
// UpsertSuffix returns the dialect-specific upsert clause.
// For SQLite: "ON CONFLICT(...) DO UPDATE SET ..."
// For PostgreSQL: "ON CONFLICT(...) DO UPDATE SET ..."
// For MySQL: "ON DUPLICATE KEY UPDATE ..."
UpsertSuffix(conflictColumns []string, updateColumns []string) string
// BlobType returns the column type for binary data.
BlobType() string
// TimestampType returns the column type for timestamps.
TimestampType() string
// TextType returns the column type for text data.
TextType() string
// Now returns the SQL expression for the current timestamp.
Now() string
}
Dialect abstracts database-specific SQL differences.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements storage.Storage using database/sql.
func (*Store) BlockingStore ¶
func (s *Store) BlockingStore() storage.BlockingStore
func (*Store) BookmarkStore ¶
func (s *Store) BookmarkStore() storage.BookmarkStore
func (*Store) MUCRoomStore ¶
func (s *Store) MUCRoomStore() storage.MUCRoomStore
func (*Store) OfflineStore ¶
func (s *Store) OfflineStore() storage.OfflineStore
func (*Store) PubSubStore ¶
func (s *Store) PubSubStore() storage.PubSubStore
func (*Store) RosterStore ¶
func (s *Store) RosterStore() storage.RosterStore
func (*Store) VCardStore ¶
func (s *Store) VCardStore() storage.VCardStore
Click to show internal directories.
Click to hide internal directories.