database

package
v0.0.0-...-47656ca Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	*dbutil.Database

	User     *UserQuery
	Portal   *PortalQuery
	Puppet   *PuppetQuery
	Message  *MessageQuery
	Reaction *ReactionQuery
}

func New

func New(baseDB *dbutil.Database, log maulogger.Logger) *Database

type Message

type Message struct {
	Chat      PortalKey
	GMID      groupme.ID
	MXID      id.EventID
	Sender    groupme.ID
	Timestamp time.Time
	Sent      bool

	Portal Portal
	// contains filtered or unexported fields
}

func (*Message) Scan

func (msg *Message) Scan(row dbutil.Scannable) *Message

type MessageQuery

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

func (*MessageQuery) GetAll

func (mq *MessageQuery) GetAll(chat PortalKey) (messages []*Message)

func (*MessageQuery) GetByGMID

func (mq *MessageQuery) GetByGMID(chat PortalKey, gmid groupme.ID) *Message

func (*MessageQuery) GetByMXID

func (mq *MessageQuery) GetByMXID(mxid id.EventID) *Message

func (*MessageQuery) GetFirstInChat

func (mq *MessageQuery) GetFirstInChat(chat PortalKey) *Message

func (*MessageQuery) GetLastInChat

func (mq *MessageQuery) GetLastInChat(chat PortalKey) *Message

func (*MessageQuery) GetLastInChatBefore

func (mq *MessageQuery) GetLastInChatBefore(chat PortalKey, maxTimestamp time.Time) *Message

func (*MessageQuery) GetMessagesBetween

func (mq *MessageQuery) GetMessagesBetween(chat PortalKey, minTimestamp, maxTimestamp time.Time) (messages []*Message)

func (*MessageQuery) New

func (mq *MessageQuery) New() *Message

type Portal

type Portal struct {
	Key  PortalKey
	MXID id.RoomID

	Name      string
	NameSet   bool
	Topic     string
	TopicSet  bool
	Avatar    string
	AvatarURL id.ContentURI
	AvatarSet bool
	Encrypted bool
	// contains filtered or unexported fields
}

func (*Portal) Delete

func (portal *Portal) Delete()

func (*Portal) Insert

func (portal *Portal) Insert()

func (*Portal) Scan

func (portal *Portal) Scan(row dbutil.Scannable) *Portal

func (*Portal) Update

func (portal *Portal) Update(txn dbutil.Transaction)

type PortalKey

type PortalKey struct {
	GMID     groupme.ID
	Receiver groupme.ID
}

GMID is the puppet or the group Receiver is the "Other Person" in a DM or the group itself in a group

func GroupPortalKey

func GroupPortalKey(gmid groupme.ID) PortalKey

func NewPortalKey

func NewPortalKey(gmid, receiver groupme.ID) PortalKey

func ParsePortalKey

func ParsePortalKey(inp string) *PortalKey

func (PortalKey) IsPrivate

func (key PortalKey) IsPrivate() bool

func (PortalKey) String

func (key PortalKey) String() string

type PortalQuery

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

func (*PortalQuery) FindPrivateChats

func (pq *PortalQuery) FindPrivateChats(receiver groupme.ID) []*Portal

func (*PortalQuery) GetAll

func (pq *PortalQuery) GetAll() []*Portal

func (*PortalQuery) GetAllByGMID

func (pq *PortalQuery) GetAllByGMID(gmid groupme.ID) []*Portal

func (*PortalQuery) GetByGMID

func (pq *PortalQuery) GetByGMID(key PortalKey) *Portal

func (*PortalQuery) GetByMXID

func (pq *PortalQuery) GetByMXID(mxid id.RoomID) *Portal

func (*PortalQuery) New

func (pq *PortalQuery) New() *Portal

type Puppet

type Puppet struct {
	GMID groupme.ID

	Displayname string
	NameSet     bool

	Avatar    string
	AvatarURL id.ContentURI
	AvatarSet bool

	CustomMXID     id.UserID
	AccessToken    string
	NextBatch      string
	EnableReceipts bool
	// contains filtered or unexported fields
}

Puppet is comment

func (*Puppet) Insert

func (puppet *Puppet) Insert()

func (*Puppet) Scan

func (puppet *Puppet) Scan(row dbutil.Scannable) *Puppet

func (*Puppet) Update

func (puppet *Puppet) Update()

type PuppetQuery

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

func (*PuppetQuery) Get

func (pq *PuppetQuery) Get(gmid groupme.ID) *Puppet

func (*PuppetQuery) GetAll

func (pq *PuppetQuery) GetAll() (puppets []*Puppet)

func (*PuppetQuery) GetAllWithCustomMXID

func (pq *PuppetQuery) GetAllWithCustomMXID() (puppets []*Puppet)

func (*PuppetQuery) GetByCustomMXID

func (pq *PuppetQuery) GetByCustomMXID(mxid id.UserID) *Puppet

func (*PuppetQuery) New

func (pq *PuppetQuery) New() *Puppet

type Reaction

type Reaction struct {
	Chat       PortalKey
	TargetGMID groupme.ID
	Sender     groupme.ID
	MXID       id.EventID
	GMID       groupme.ID
	// contains filtered or unexported fields
}

func (*Reaction) Delete

func (reaction *Reaction) Delete()

func (*Reaction) GetTarget

func (reaction *Reaction) GetTarget() *Message

func (*Reaction) Scan

func (reaction *Reaction) Scan(row dbutil.Scannable) *Reaction

func (*Reaction) Upsert

func (reaction *Reaction) Upsert(txn dbutil.Execable)

type ReactionQuery

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

func (*ReactionQuery) GetByMXID

func (rq *ReactionQuery) GetByMXID(mxid id.EventID) *Reaction

func (*ReactionQuery) GetByTargetGMID

func (rq *ReactionQuery) GetByTargetGMID(chat PortalKey, gmid groupme.ID, sender groupme.ID) *Reaction

func (*ReactionQuery) New

func (mq *ReactionQuery) New() *Reaction

type User

type User struct {
	MXID           id.UserID
	GMID           groupme.ID
	ManagementRoom id.RoomID
	SpaceRoom      id.RoomID

	Token string
	// contains filtered or unexported fields
}

func (*User) Insert

func (user *User) Insert()

func (*User) IsInSpace

func (user *User) IsInSpace(portal PortalKey) bool

func (*User) MarkInSpace

func (user *User) MarkInSpace(portal PortalKey)

func (*User) Scan

func (user *User) Scan(row dbutil.Scannable) *User

func (*User) Update

func (user *User) Update()

type UserQuery

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

func (*UserQuery) GetAll

func (uq *UserQuery) GetAll() (users []*User)

func (*UserQuery) GetByGMID

func (uq *UserQuery) GetByGMID(gmid groupme.ID) *User

func (*UserQuery) GetByMXID

func (uq *UserQuery) GetByMXID(userID id.UserID) *User

func (*UserQuery) New

func (uq *UserQuery) New() *User

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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