Documentation
¶
Overview ¶
The models package defines how the Application server interacts with the local SQLITE database to store information. Currently, the DB will only store
- Identities - Contacts - Messages - Standard Key-Value (string or []byte)
This may change in the future.
Index ¶
- func CreateTables(conn gdb.Database) (map[string]gdb.Table, error)
- type Address
- type Alias
- type Component
- type Contact
- type ContactMembership
- type DeveloperPlugin
- type DeveloperPluginPermissions
- type DeveloperPluginTile
- type DeveloperPluginVersion
- type DeveloperPluginViewer
- type Identity
- type JSONComponent
- type JSONMessage
- type JSONMessageList
- type JSONProfile
- type List
- type Message
- type Migration
- type MigrationFunc
- type MigrationRecord
- type Profile
- type Record
- type Store
- func (s *Store) CreateTables() error
- func (s *Store) Get(key string) (string, error)
- func (s *Store) GetBytes(key string) ([]byte, error)
- func (s *Store) GetConnection() error
- func (s *Store) GetDefault(key string, alt string) (string, error)
- func (s *Store) Set(key string, value string) error
- func (s *Store) SetBytes(key string, value []byte) error
- func (s *Store) TableName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Alias ¶
type Alias struct {
Id gdb.PrimaryKey
Identity *gdb.HasOne `table:"identity"`
Location string
Username string
}
Alias represent a registered Identity
type Component ¶
type Component struct {
Id gdb.PrimaryKey
Message *gdb.HasOne `table:"message"`
Name string
Data []byte
}
An AirDispatch Component
type Contact ¶
type Contact struct {
Id gdb.PrimaryKey `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
Notify bool `json:"favorite"`
Addresses *gdb.HasMany `table:"address" on:"contact" json:"-"`
List *gdb.HasMany `table:"contact_membership" on:"contact" json:"-"`
// JSON Specific Transient Fields
Identities []*Address `db:"-" json:"addresses"`
Profile *JSONProfile `db:"-" json:"profile"`
Lists []*List `db:"-" json:"lists"`
}
type ContactMembership ¶
type DeveloperPlugin ¶
type DeveloperPlugin struct {
// Plugin Information
Id gdb.PrimaryKey `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Image string `json:image"`
// Source Information
Source string `json:"source"`
}
DeveloperPlugin is analogous to the message that publishes a plugin to the world
`plugins/chat`
type DeveloperPluginTile ¶
type DeveloperPluginVersion ¶
type DeveloperPluginVersion struct {
Version string `json:"version"`
Changelog string `json:"changelog"`
// Permissions Information
Permissions []DeveloperPluginPermissions `db:"-" json:"permissions"`
PermissionsData []byte `json:"-"`
// Extras Information
Viewers []DeveloperPluginViewer `db:"-" json:"viewers"`
Tiles []DeveloperPluginTile `db:"-" json:"tiles"`
ViewersData []byte `json:"-"`
TilesData []byte `json:"-"`
// Data Information
Data string `json:"data"`
}
DeveloperPluginVersion has version-specific information.
`plugins/chat/0.0.1`
type DeveloperPluginViewer ¶
type Identity ¶
type Identity struct {
Id gdb.PrimaryKey `json:"-"`
Nickname string
Fingerprint string
// Server Information and Tacking
Server string
ServerKey string
ServerFingerprint string
ServerAlias string
// Actual Data
Data []byte `json:"-"`
// Password Protection
Protected bool
Aliases *gdb.HasMany `table:"alias" on:"identity"`
// Profile
Profile *gdb.HasOne `table:"profile"`
// Transcendence
Current bool `db:"-"`
}
Identity represents a Keypair
func CreateIdentityFromDispatch ¶
CreateIdentityFromDispatch will take an (*identity).Identity from the AirDispatch package and a key (to encrypt the identity with) and return an *Identity suitable for inserting into the database.
func (*Identity) CreateServerFromIdentity ¶
type JSONComponent ¶
type JSONMessage ¶
type JSONMessage struct {
Name string `json:"name"`
Date time.Time `json:"date"`
From *JSONProfile `json:"from"`
To []*JSONProfile `json:"to"`
Public bool `json:"public"`
Self bool `json:"self"`
Components map[string]*JSONComponent `json:"components"`
Context map[string]string `json:"context"`
}
func (*JSONMessage) ToDispatch ¶
type JSONMessageList ¶
type JSONMessageList []*JSONMessage
JSON Encoding
func (JSONMessageList) Len ¶
func (m JSONMessageList) Len() int
func (JSONMessageList) Swap ¶
func (m JSONMessageList) Swap(i int, j int)
type JSONProfile ¶
type Message ¶
type Message struct {
Id gdb.PrimaryKey
// Name registered on Server
Name string
// Cleared Addresses
To string
// Fingerprint of Sender
From string
// Message Metadata
Alert bool
Incoming bool
Date int64
Components *gdb.HasMany `table:"component" on:"message"`
}
A full AirDispatch Message
type MigrationFunc ¶
type MigrationRecord ¶
type MigrationRecord struct {
Id gdb.PrimaryKey
Migration int
DateApplied *time.Time
}
type Profile ¶
type Profile struct {
Id gdb.PrimaryKey `json:"-"`
Name string `json:"name"`
Image string `json:"image"`
Description string `json:"description"`
}
type Store ¶
type Store struct {
*sqlx.DB
Filename string
Prefix string
// contains filtered or unexported fields
}