mysqlstore

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	DatabaseErrorHandler func(device *store.Device, action string, attemptIndex int, err error) (retry bool)
	// contains filtered or unexported fields
}

Container is a wrapper for a SQL database that can contain multiple whatsmeow sessions.

func New added in v2.0.2

func New(db gdb.DB, log waLog.Logger) (*Container, error)

func (*Container) Close

func (c *Container) Close() error

func (*Container) DeleteDevice

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

func (*Container) GetAllDevices

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

GetAllDevices finds all the devices in the database.

func (*Container) GetDevice

func (c *Container) GetDevice(jid types.JID) (*store.Device, error)

GetDevice finds the device with the specified JID in the database.

If the device is not found, nil is returned instead.

Note that the parameter usually must be an AD-JID.

func (*Container) GetFirstDevice

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

GetFirstDevice is a convenience method for getting the first device in the store. If there are no devices, then a new device will be created. You should only use this if you don't want to have multiple sessions simultaneously.

func (*Container) NewDevice

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

func (*Container) PutDevice

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

type Store

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

func NewSQLStore

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

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) 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) 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) 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) 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) 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