sqlstore

package
v0.0.0-...-aaee23e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package sqlstore contains an SQL-backed implementation of the interfaces in the store package.

Index

Constants

This section is empty.

Variables

View Source
var Container *container
View Source
var Upgrades = [...]upgradeFunc{upgradeV1, upgradeV2, upgradeV3, upgradeV4, upgradeV5, upgradeV6}

Upgrades is a list of functions that will upgrade a database to the latest version.

This may be of use if you want to manage the database fully manually, but in most cases you should just call Container.Upgrade to let the library handle everything.

Functions

func New

func New(ctx context.Context, log waLog.Logger) (*container, error)

Types

type Store

type Store struct {
	JID string
	// contains filtered or unexported fields
}

func NewSQLStore

func NewSQLStore(c *container, jid types.JID) *Store

func (Store) Close

func (c Store) Close() error

func (*Store) DeleteAllIdentities

func (s *Store) DeleteAllIdentities(phone string) error

func (*Store) DeleteAllSessions

func (s *Store) DeleteAllSessions(phone string) error

func (*Store) DeleteAppStateMutationMACs

func (s *Store) DeleteAppStateMutationMACs(name string, indexMACs [][]byte) (err error)

func (*Store) DeleteAppStateVersion

func (s *Store) DeleteAppStateVersion(name string) error

func (Store) DeleteDevice

func (c Store) DeleteDevice(store *store.Device) error

func (*Store) DeleteIdentity

func (s *Store) DeleteIdentity(address string) error

func (*Store) DeleteSession

func (s *Store) DeleteSession(address string) error

func (*Store) GenOnePreKey

func (s *Store) GenOnePreKey() (*keys.PreKey, error)

func (*Store) GetAllContacts

func (s *Store) GetAllContacts() (map[types.JID]types.ContactInfo, error)

func (Store) GetAllDevices

func (c Store) GetAllDevices() ([]*store.Device, error)

func (*Store) GetAppStateMutationMAC

func (s *Store) GetAppStateMutationMAC(name string, indexMAC []byte) (valueMAC []byte, err error)

func (*Store) GetAppStateSyncKey

func (s *Store) GetAppStateSyncKey(id []byte) (*store.AppStateSyncKey, error)

func (*Store) GetAppStateVersion

func (s *Store) GetAppStateVersion(name string) (version uint64, hash [128]byte, err error)

func (*Store) GetChatSettings

func (s *Store) GetChatSettings(chat types.JID) (settings types.LocalChatSettings, err error)

func (*Store) GetContact

func (s *Store) GetContact(user types.JID) (types.ContactInfo, error)

func (Store) GetFirstDevice

func (c Store) GetFirstDevice() (*store.Device, error)

func (*Store) GetLatestAppStateSyncKeyID

func (s *Store) GetLatestAppStateSyncKeyID() ([]byte, error)

func (*Store) GetMessageSecret

func (s *Store) GetMessageSecret(chat, sender types.JID, id types.MessageID) (secret []byte, err error)

func (*Store) GetOrGenPreKeys

func (s *Store) GetOrGenPreKeys(count uint32) ([]*keys.PreKey, error)

func (*Store) GetPreKey

func (s *Store) GetPreKey(id uint32) (*keys.PreKey, error)

func (*Store) GetPrivacyToken

func (s *Store) GetPrivacyToken(user types.JID) (*store.PrivacyToken, error)

func (*Store) GetSenderKey

func (s *Store) GetSenderKey(group, user string) (key []byte, err error)

func (*Store) GetSession

func (s *Store) GetSession(address string) (session []byte, err error)

func (*Store) HasSession

func (s *Store) HasSession(address string) (has bool, err error)

func (*Store) IsTrustedIdentity

func (s *Store) IsTrustedIdentity(address string, key [32]byte) (bool, error)

func (*Store) MarkPreKeysAsUploaded

func (s *Store) MarkPreKeysAsUploaded(upToID uint32) error

func (Store) NewDevice

func (c Store) NewDevice() *store.Device

func (*Store) PutAllContactNames

func (s *Store) PutAllContactNames(contacts []store.ContactEntry) error

func (*Store) PutAppStateMutationMACs

func (s *Store) PutAppStateMutationMACs(name string, version uint64, mutations []store.AppStateMutationMAC) error

func (*Store) PutAppStateSyncKey

func (s *Store) PutAppStateSyncKey(id []byte, key store.AppStateSyncKey) error

func (*Store) PutAppStateVersion

func (s *Store) PutAppStateVersion(name string, version uint64, hash [128]byte) error

func (*Store) PutArchived

func (s *Store) PutArchived(chat types.JID, archived bool) error

func (*Store) PutBusinessName

func (s *Store) PutBusinessName(user types.JID, businessName string) (bool, string, error)

func (*Store) PutContactName

func (s *Store) PutContactName(user types.JID, firstName, fullName string) error

func (Store) PutDevice

func (c Store) PutDevice(device *store.Device) error

func (*Store) PutIdentity

func (s *Store) PutIdentity(address string, key [32]byte) error

func (*Store) PutMessageSecret

func (s *Store) PutMessageSecret(chat, sender types.JID, id types.MessageID, secret []byte) (err error)

func (*Store) PutMessageSecrets

func (s *Store) PutMessageSecrets(inserts []store.MessageSecretInsert) (err error)

func (*Store) PutMutedUntil

func (s *Store) PutMutedUntil(chat types.JID, mutedUntil time.Time) error

func (*Store) PutPinned

func (s *Store) PutPinned(chat types.JID, pinned bool) error

func (*Store) PutPrivacyTokens

func (s *Store) PutPrivacyTokens(tokens ...store.PrivacyToken) error

func (*Store) PutPushName

func (s *Store) PutPushName(user types.JID, pushName string) (bool, string, error)

func (*Store) PutSenderKey

func (s *Store) PutSenderKey(group, user string, session []byte) error

func (*Store) PutSession

func (s *Store) PutSession(address string, session []byte) error

func (*Store) RemovePreKey

func (s *Store) RemovePreKey(id uint32) error

func (*Store) UploadedPreKeyCount

func (s *Store) UploadedPreKeyCount() (count int, err error)

Jump to

Keyboard shortcuts

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