messengerdb

package
v2.470.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0, MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetInMemoryTestDBOptsUndefined = iota
	GetInMemoryTestDBOptsNoInit
	GetInMemoryTestDBOptsStdOutLogger
	GetInMemoryTestDBOptsNoFTS
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	ColumnID  string
	Name      string
	Type      string
	NotNull   *string
	DfltValue *string
	PK        string
}

func (*ColumnInfo) Equals

func (t *ColumnInfo) Equals(other *ColumnInfo) bool

type DBWrapper

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

func GetInMemoryTestDB

func GetInMemoryTestDB(t testing.TB, opts ...GetInMemoryTestDBOpts) (*DBWrapper, *gorm.DB, func())

func NewDBWrapper

func NewDBWrapper(db *gorm.DB, log *zap.Logger) *DBWrapper

func (*DBWrapper) AccountSetReplicationAutoEnable

func (d *DBWrapper) AccountSetReplicationAutoEnable(pk string, enabled bool) error

func (*DBWrapper) AccountUpdateFlag

func (d *DBWrapper) AccountUpdateFlag(pk string, flagName string, enabled bool) error

func (*DBWrapper) AddContactRequestIncomingAccepted

func (d *DBWrapper) AddContactRequestIncomingAccepted(contactPK, groupPK string) (*messengertypes.Contact, error)

func (*DBWrapper) AddContactRequestIncomingReceived

func (d *DBWrapper) AddContactRequestIncomingReceived(contactPK, displayName, groupPk string) (*messengertypes.Contact, error)

func (*DBWrapper) AddContactRequestOutgoingEnqueued

func (d *DBWrapper) AddContactRequestOutgoingEnqueued(contactPK, displayName, convPK string) (*messengertypes.Contact, error)

func (*DBWrapper) AddContactRequestOutgoingSent

func (d *DBWrapper) AddContactRequestOutgoingSent(contactPK string) (*messengertypes.Contact, error)

func (*DBWrapper) AddConversation

func (d *DBWrapper) AddConversation(groupPK, ownMemberPK, ownDevicePK string) (*messengertypes.Conversation, error)

func (*DBWrapper) AddConversationForContact

func (d *DBWrapper) AddConversationForContact(groupPK, ownMemberPK, ownDevicePK, contactPK string) (*messengertypes.Conversation, error)

func (*DBWrapper) AddDevice

func (d *DBWrapper) AddDevice(devicePK string, memberPK string) (*messengertypes.Device, error)

func (*DBWrapper) AddInteraction

func (d *DBWrapper) AddInteraction(rawInte *messengertypes.Interaction) (*messengertypes.Interaction, bool, error)

func (*DBWrapper) AddMember

func (d *DBWrapper) AddMember(memberPK, groupPK, displayName, avatarCID string, isMe bool, isCreator bool) (*messengertypes.Member, error)

func (*DBWrapper) AddServiceToken

func (d *DBWrapper) AddServiceToken(accountPK string, serviceToken *messengertypes.AppMessage_ServiceAddToken) error

func (*DBWrapper) AttributeBacklogInteractions

func (d *DBWrapper) AttributeBacklogInteractions(devicePK, groupPK, memberPK string) ([]*messengertypes.Interaction, error)

func (*DBWrapper) DeleteInteractions

func (d *DBWrapper) DeleteInteractions(cids []string) error

func (*DBWrapper) DisableFTS

func (d *DBWrapper) DisableFTS() *DBWrapper

func (*DBWrapper) FirstOrCreateAccount

func (d *DBWrapper) FirstOrCreateAccount(pk, link string) error

func (*DBWrapper) GetAccount

func (d *DBWrapper) GetAccount() (*messengertypes.Account, error)

atomic

func (*DBWrapper) GetAccountDirectoryServiceRecord added in v2.452.0

func (d *DBWrapper) GetAccountDirectoryServiceRecord(serviceAddr string, recordToken string) (*messengertypes.AccountDirectoryServiceRecord, error)

func (*DBWrapper) GetAcknowledgementsCIDsForInteraction

func (d *DBWrapper) GetAcknowledgementsCIDsForInteraction(cid string) ([]string, error)

func (*DBWrapper) GetAllContacts

func (d *DBWrapper) GetAllContacts() ([]*messengertypes.Contact, error)

func (*DBWrapper) GetAllConversations

func (d *DBWrapper) GetAllConversations() ([]*messengertypes.Conversation, error)

func (*DBWrapper) GetAllInteractions

func (d *DBWrapper) GetAllInteractions() ([]*messengertypes.Interaction, error)

func (*DBWrapper) GetAllMembers

func (d *DBWrapper) GetAllMembers() ([]*messengertypes.Member, error)

func (*DBWrapper) GetAugmentedInteraction

func (d *DBWrapper) GetAugmentedInteraction(cid string) (*messengertypes.Interaction, error)

func (*DBWrapper) GetContactByConversation added in v2.470.0

func (d *DBWrapper) GetContactByConversation(conversationPK string) (*messengertypes.Contact, error)

func (*DBWrapper) GetContactByPK

func (d *DBWrapper) GetContactByPK(publicKey string) (*messengertypes.Contact, error)

atomic

func (*DBWrapper) GetContactsByState

func (d *DBWrapper) GetContactsByState(state messengertypes.Contact_State) ([]*messengertypes.Contact, error)

func (*DBWrapper) GetConversationByPK

func (d *DBWrapper) GetConversationByPK(publicKey string) (*messengertypes.Conversation, error)

func (*DBWrapper) GetDBInfo

func (d *DBWrapper) GetDBInfo() (*messengertypes.SystemInfo_DB, error)

func (*DBWrapper) GetDeviceByPK

func (d *DBWrapper) GetDeviceByPK(publicKey string) (*messengertypes.Device, error)

func (*DBWrapper) GetDevicesForContact added in v2.470.0

func (d *DBWrapper) GetDevicesForContact(conversationPK string, contactPK string) ([]*messengertypes.Device, error)

GetDevicesForContact returns the devices for a given contact of contact conversation.

func (*DBWrapper) GetDevicesForMember added in v2.344.0

func (d *DBWrapper) GetDevicesForMember(conversationPK string, memberPK string) ([]*messengertypes.Device, error)

func (*DBWrapper) GetInteractionByCID

func (d *DBWrapper) GetInteractionByCID(cid string) (*messengertypes.Interaction, error)

func (*DBWrapper) GetMemberByPK

func (d *DBWrapper) GetMemberByPK(publicKey string, convPK string) (*messengertypes.Member, error)

func (*DBWrapper) GetMembersByConversation added in v2.470.0

func (d *DBWrapper) GetMembersByConversation(conversationPK string) ([]*messengertypes.Member, error)

func (*DBWrapper) GetMuteStatusForConversation added in v2.381.0

func (d *DBWrapper) GetMuteStatusForConversation(key string) (accountMuted bool, conversationMuted bool, err error)

func (*DBWrapper) GetPaginatedInteractions

func (d *DBWrapper) GetPaginatedInteractions(opts *messengertypes.PaginatedInteractionsOptions) ([]*messengertypes.Interaction, error)

func (*DBWrapper) GetPushDeviceToken added in v2.470.0

func (d *DBWrapper) GetPushDeviceToken(accountPK string) (*messengertypes.PushDeviceToken, error)

GetPushDeviceToken returns the push device token for the given accountPK.

func (*DBWrapper) GetPushMemberToken added in v2.470.0

func (d *DBWrapper) GetPushMemberToken(tokenID string) (*messengertypes.PushMemberToken, error)

GetPushMemberToken returns the push member token for the given tokenID.

func (*DBWrapper) GetPushMemberTokens added in v2.470.0

func (d *DBWrapper) GetPushMemberTokens(conversationPK, devicePK string) ([]*messengertypes.PushMemberToken, error)

GetPushMemberTokens returns the push tokens of the member's device for the given conversationPK.

func (*DBWrapper) GetPushMemberTokensForConversation added in v2.470.0

func (d *DBWrapper) GetPushMemberTokensForConversation(conversationPK string) ([]*messengertypes.PushMemberToken, error)

GetPushMemberTokensForConversation returns the push token devices for the given conversationPK.

func (*DBWrapper) GetPushServerRecord added in v2.470.0

func (d *DBWrapper) GetPushServerRecord(accountPK, serverAddr string) (*messengertypes.PushServerRecord, error)

GetPushServerRecord returns the push server record for the given accountPK and serverAddr.

func (*DBWrapper) GetPushServerRecords added in v2.470.0

func (d *DBWrapper) GetPushServerRecords(accountPK string) ([]*messengertypes.PushServerRecord, error)

GetPushServerRecords returns the list of push server records for the given accountPK.

func (*DBWrapper) GetPushSharedLocalDeviceTokens added in v2.470.0

func (d *DBWrapper) GetPushSharedLocalDeviceTokens(conversationPK string) ([]*messengertypes.PushLocalDeviceSharedToken, error)

func (*DBWrapper) GetServiceToken added in v2.470.0

func (d *DBWrapper) GetServiceToken(accountPK, tokenID string) (*messengertypes.ServiceToken, error)

GetServiceToken returns the service tokens for the given accountPK.

func (*DBWrapper) GetServiceTokens added in v2.470.0

func (d *DBWrapper) GetServiceTokens(accountPK string) ([]*messengertypes.ServiceToken, error)

GetServiceToken returns the service token for the given accountPK and tokenID.

func (*DBWrapper) GetVerifiedCredentials added in v2.452.0

func (d *DBWrapper) GetVerifiedCredentials(identifier string, issuer string) ([]*messengertypes.AccountVerifiedCredential, error)

func (*DBWrapper) InitDB

func (d *DBWrapper) InitDB(replayer func(d *DBWrapper) error) error

func (*DBWrapper) InteractionIndexText

func (d *DBWrapper) InteractionIndexText(interactionCID string, text string) error

func (*DBWrapper) InteractionsSearch

func (d *DBWrapper) InteractionsSearch(query string, options *SearchOptions) ([]*messengertypes.Interaction, error)

func (*DBWrapper) IsConversationOpened

func (d *DBWrapper) IsConversationOpened(conversationPK string) (bool, error)

func (*DBWrapper) IsFromSelf

func (d *DBWrapper) IsFromSelf(groupPK string, devicePK string) (bool, error)

func (*DBWrapper) KeepDatabaseLocalState

func (d *DBWrapper) KeepDatabaseLocalState() *messengertypes.LocalDatabaseState

func (*DBWrapper) MarkAccountDirectoryServiceRecordAsRevoked added in v2.452.0

func (d *DBWrapper) MarkAccountDirectoryServiceRecordAsRevoked(serverAddr string, token string, removalDate int64) error

func (*DBWrapper) MarkInteractionAsAcknowledged

func (d *DBWrapper) MarkInteractionAsAcknowledged(cid string) (*messengertypes.Interaction, error)

func (*DBWrapper) MarkMemberAsConversationCreator

func (d *DBWrapper) MarkMemberAsConversationCreator(memberPK, conversationPK string) error

func (*DBWrapper) MarkMetadataEventHandled

func (d *DBWrapper) MarkMetadataEventHandled(eventContext *protocoltypes.EventContext) (bool, error)

func (*DBWrapper) MuteConversation added in v2.381.0

func (d *DBWrapper) MuteConversation(pk string, until int64) error

func (*DBWrapper) PostAction added in v2.470.0

func (d *DBWrapper) PostAction(action func(d *DBWrapper) error) (err error)

func (*DBWrapper) PushSetReplicationAutoShare

func (d *DBWrapper) PushSetReplicationAutoShare(pk string, enabled bool) error

func (*DBWrapper) RestoreFromBackup

func (d *DBWrapper) RestoreFromBackup(backup *messengertypes.LocalDatabaseState, replayLogsToDB func() error) error

func (*DBWrapper) SaveAccountDirectoryServiceRecord added in v2.452.0

func (d *DBWrapper) SaveAccountDirectoryServiceRecord(accountPK string, message *messengertypes.AppMessage_AccountDirectoryServiceRegistered) error

func (*DBWrapper) SaveAccountVerifiedCredential added in v2.448.0

func (d *DBWrapper) SaveAccountVerifiedCredential(ev *protocoltypes.AccountVerifiedCredentialRegistered) error

func (*DBWrapper) SaveConversationReplicationInfo

func (d *DBWrapper) SaveConversationReplicationInfo(c *messengertypes.ConversationReplicationInfo) error

func (*DBWrapper) SavePushDeviceToken added in v2.470.0

func (d *DBWrapper) SavePushDeviceToken(accountPK string, message *messengertypes.AppMessage_PushSetDeviceToken) error

SavePushDeviceToken saves the push device token in the database for the given accountPK. If the push device token already exists, the key is updated.

func (*DBWrapper) SavePushLocalDeviceSharedToken added in v2.470.0

func (d *DBWrapper) SavePushLocalDeviceSharedToken(tokenID, conversationPK string) error

SavePushLocalDeviceSharedToken saves the push token ID of the local device for the given conversationPK.

func (*DBWrapper) SavePushMemberToken added in v2.470.0

func (d *DBWrapper) SavePushMemberToken(tokenID, conversationPK string, message *messengertypes.AppMessage_PushSetMemberToken) error

SavePushMemberToken saves the push member token in the database for the given ConversationPK.

func (*DBWrapper) SavePushServer added in v2.470.0

func (d *DBWrapper) SavePushServer(accountPK string, message *messengertypes.AppMessage_PushSetServer) error

SavePushServer saves the push server key in the database for the given accountPK and serverAddr. If the server already exists, the key is updated.

func (*DBWrapper) SetConversationIsOpenStatus

func (d *DBWrapper) SetConversationIsOpenStatus(conversationPK string, status bool) (*messengertypes.Conversation, bool, error)

func (*DBWrapper) TX

func (d *DBWrapper) TX(ctx context.Context, txFunc func(*DBWrapper) error) (err error)

func (*DBWrapper) UpdateAccount

func (d *DBWrapper) UpdateAccount(pk, url, displayName string) (*messengertypes.Account, error)

func (*DBWrapper) UpdateAccountFields added in v2.381.0

func (d *DBWrapper) UpdateAccountFields(fields map[string]interface{}) error

func (*DBWrapper) UpdateContact

func (d *DBWrapper) UpdateContact(pk string, contact *messengertypes.Contact) error

func (*DBWrapper) UpdateConversation

func (d *DBWrapper) UpdateConversation(c *messengertypes.Conversation) (bool, error)

func (*DBWrapper) UpdateConversationReadState

func (d *DBWrapper) UpdateConversationReadState(pk string, newUnread bool, eventDate time.Time) error

func (*DBWrapper) UpsertMember

func (d *DBWrapper) UpsertMember(memberPK, groupPK string, m *messengertypes.Member) (*messengertypes.Member, bool, error)

type GetInMemoryTestDBOpts

type GetInMemoryTestDBOpts int32

type SearchOptions

type SearchOptions struct {
	BeforeDate     int
	AfterDate      int
	Limit          int
	RefCID         string
	OldestToNewest bool
}

Jump to

Keyboard shortcuts

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