messengerdb

package
v2.429.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0, MIT Imports: 21 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) AddMedias

func (d *DBWrapper) AddMedias(medias []*messengertypes.Media) ([]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(serviceToken *protocoltypes.ServiceToken) error

func (*DBWrapper) AttributeBacklogInteractions

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

func (*DBWrapper) BuildReactionsView

func (d *DBWrapper) BuildReactionsView(cid string) ([]*messengertypes.Interaction_ReactionView, error)

func (*DBWrapper) CreateOrUpdateReaction

func (d *DBWrapper) CreateOrUpdateReaction(reaction *messengertypes.Reaction) (bool, 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) 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) GetAllMedias

func (d *DBWrapper) GetAllMedias() ([]*messengertypes.Media, 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) 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) GetCurrentReactionsByValueAndMember

func (d *DBWrapper) GetCurrentReactionsByValueAndMember(memberPublicKey string, targetCID string, emoji string) ([]*messengertypes.Reaction, 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) 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) GetInteractionReactionsForEmoji added in v2.349.0

func (d *DBWrapper) GetInteractionReactionsForEmoji(cid string, emoji string) ([]*messengertypes.Reaction, error)

func (*DBWrapper) GetMedias

func (d *DBWrapper) GetMedias(cids []string) ([]*messengertypes.Media, error)

atomic

func (*DBWrapper) GetMemberByPK

func (d *DBWrapper) GetMemberByPK(publicKey string, convPK 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) GetNextMedia

func (d *DBWrapper) GetNextMedia(lastCID string, opts NextMediaOpts) (*messengertypes.Media, error)

func (*DBWrapper) GetPushTokenSharedForConversation added in v2.344.0

func (d *DBWrapper) GetPushTokenSharedForConversation(pk string) ([]*messengertypes.SharedPushToken, error)

func (*DBWrapper) GetReplyOptionsCIDForConversation

func (d *DBWrapper) GetReplyOptionsCIDForConversation(pk string) (string, 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) 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) 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) SaveConversationReplicationInfo

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

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, avatarCID 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) UpdateDevicePushServer

func (d *DBWrapper) UpdateDevicePushServer(server *protocoltypes.PushServer) (*messengertypes.Account, error)

func (*DBWrapper) UpdateDevicePushToken

func (d *DBWrapper) UpdateDevicePushToken(token *protocoltypes.PushServiceReceiver) (*messengertypes.Account, error)

func (*DBWrapper) UpdateDeviceSetPushToken added in v2.344.0

func (d *DBWrapper) UpdateDeviceSetPushToken(ctx context.Context, memberPK string, devicePK string, conversationPK string, token string) error

func (*DBWrapper) UpsertMember

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

type GetInMemoryTestDBOpts

type GetInMemoryTestDBOpts int32

type NextMediaOpts

type NextMediaOpts struct {
	FileNames []string
	MimeTypes []string
}

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