db

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlockStore

func NewBlockStore(db *sql.DB, lock *sync.Mutex) repo.BlockStore

func NewConfigStore

func NewConfigStore(db *sql.DB, lock *sync.Mutex, path string) repo.ConfigStore

func NewDeviceStore

func NewDeviceStore(db *sql.DB, lock *sync.Mutex) repo.DeviceStore

func NewNotificationStore

func NewNotificationStore(db *sql.DB, lock *sync.Mutex) repo.NotificationStore

func NewOfflineMessageStore

func NewOfflineMessageStore(db *sql.DB, lock *sync.Mutex) repo.OfflineMessageStore

func NewPeerStore

func NewPeerStore(db *sql.DB, lock *sync.Mutex) repo.PeerStore

func NewPinRequestStore

func NewPinRequestStore(db *sql.DB, lock *sync.Mutex) repo.PinRequestStore

func NewPointerStore

func NewPointerStore(db *sql.DB, lock *sync.Mutex) repo.PointerStore

func NewProfileStore

func NewProfileStore(db *sql.DB, lock *sync.Mutex) repo.ProfileStore

func NewThreadStore

func NewThreadStore(db *sql.DB, lock *sync.Mutex) repo.ThreadStore

Types

type BlockDB

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

func (*BlockDB) Add

func (c *BlockDB) Add(block *repo.Block) error

func (*BlockDB) BeginTransaction

func (m *BlockDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*BlockDB) Count

func (c *BlockDB) Count(query string) int

func (*BlockDB) Delete

func (c *BlockDB) Delete(id string) error

func (*BlockDB) DeleteByThreadId

func (c *BlockDB) DeleteByThreadId(threadId string) error

func (*BlockDB) ExecuteQuery

func (m *BlockDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*BlockDB) Get

func (c *BlockDB) Get(id string) *repo.Block

func (*BlockDB) GetByDataId

func (c *BlockDB) GetByDataId(dataId string) *repo.Block

func (*BlockDB) List

func (c *BlockDB) List(offset string, limit int, query string) []repo.Block

func (*BlockDB) PrepareAndExecuteQuery

func (m *BlockDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*BlockDB) PrepareQuery

func (m *BlockDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

type ConfigDB

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

func (*ConfigDB) Configure

func (c *ConfigDB) Configure(created time.Time) error

func (*ConfigDB) GetCreationDate

func (c *ConfigDB) GetCreationDate() (time.Time, error)

func (*ConfigDB) Init

func (c *ConfigDB) Init(password string) error

func (*ConfigDB) IsEncrypted

func (c *ConfigDB) IsEncrypted() bool

type DeviceDB

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

func (*DeviceDB) Add

func (c *DeviceDB) Add(device *repo.Device) error

func (*DeviceDB) BeginTransaction

func (m *DeviceDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*DeviceDB) Count

func (c *DeviceDB) Count(query string) int

func (*DeviceDB) Delete

func (c *DeviceDB) Delete(id string) error

func (*DeviceDB) ExecuteQuery

func (m *DeviceDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*DeviceDB) Get

func (c *DeviceDB) Get(id string) *repo.Device

func (*DeviceDB) List

func (c *DeviceDB) List(query string) []repo.Device

func (*DeviceDB) PrepareAndExecuteQuery

func (m *DeviceDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*DeviceDB) PrepareQuery

func (m *DeviceDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

type NotificationDB

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

func (*NotificationDB) Add

func (c *NotificationDB) Add(notification *repo.Notification) error

func (*NotificationDB) BeginTransaction

func (m *NotificationDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*NotificationDB) CountUnread

func (c *NotificationDB) CountUnread() int

func (*NotificationDB) Delete

func (c *NotificationDB) Delete(id string) error

func (*NotificationDB) DeleteByActorId

func (c *NotificationDB) DeleteByActorId(actorId string) error

func (*NotificationDB) DeleteByBlockId

func (c *NotificationDB) DeleteByBlockId(blockId string) error

func (*NotificationDB) DeleteBySubjectId

func (c *NotificationDB) DeleteBySubjectId(subjectId string) error

func (*NotificationDB) ExecuteQuery

func (m *NotificationDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*NotificationDB) Get

func (c *NotificationDB) Get(id string) *repo.Notification

func (*NotificationDB) List

func (c *NotificationDB) List(offset string, limit int, query string) []repo.Notification

func (*NotificationDB) PrepareAndExecuteQuery

func (m *NotificationDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*NotificationDB) PrepareQuery

func (m *NotificationDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*NotificationDB) Read

func (c *NotificationDB) Read(id string) error

func (*NotificationDB) ReadAll

func (c *NotificationDB) ReadAll() error

type OfflineMessageDB

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

func (*OfflineMessageDB) BeginTransaction

func (m *OfflineMessageDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*OfflineMessageDB) DeleteMessage

func (o *OfflineMessageDB) DeleteMessage(url string) error

func (*OfflineMessageDB) ExecuteQuery

func (m *OfflineMessageDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*OfflineMessageDB) GetMessages

func (o *OfflineMessageDB) GetMessages() (map[string][]byte, error)

func (*OfflineMessageDB) Has

func (o *OfflineMessageDB) Has(url string) bool

func (*OfflineMessageDB) PrepareAndExecuteQuery

func (m *OfflineMessageDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*OfflineMessageDB) PrepareQuery

func (m *OfflineMessageDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*OfflineMessageDB) Put

func (o *OfflineMessageDB) Put(url string) error

func (*OfflineMessageDB) SetMessage

func (o *OfflineMessageDB) SetMessage(url string, message []byte) error

type PeerDB

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

func (*PeerDB) Add

func (c *PeerDB) Add(peer *repo.Peer) error

func (*PeerDB) BeginTransaction

func (m *PeerDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*PeerDB) Count

func (c *PeerDB) Count(query string, distinct bool) int

func (*PeerDB) Delete

func (c *PeerDB) Delete(id string, threadId string) error

func (*PeerDB) DeleteByThreadId

func (c *PeerDB) DeleteByThreadId(threadId string) error

func (*PeerDB) ExecuteQuery

func (m *PeerDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*PeerDB) Get

func (c *PeerDB) Get(row string) *repo.Peer

func (*PeerDB) GetById

func (c *PeerDB) GetById(id string) *repo.Peer

func (*PeerDB) List

func (c *PeerDB) List(offset string, limit int, query string) []repo.Peer

func (*PeerDB) PrepareAndExecuteQuery

func (m *PeerDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*PeerDB) PrepareQuery

func (m *PeerDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

type PinRequestDB

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

func (*PinRequestDB) BeginTransaction

func (m *PinRequestDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*PinRequestDB) Delete

func (c *PinRequestDB) Delete(id string) error

func (*PinRequestDB) ExecuteQuery

func (m *PinRequestDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*PinRequestDB) List

func (c *PinRequestDB) List(offset string, limit int) []repo.PinRequest

func (*PinRequestDB) PrepareAndExecuteQuery

func (m *PinRequestDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*PinRequestDB) PrepareQuery

func (m *PinRequestDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*PinRequestDB) Put

func (c *PinRequestDB) Put(pr *repo.PinRequest) error

type PointersDB

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

func (*PointersDB) BeginTransaction

func (m *PointersDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*PointersDB) Delete

func (p *PointersDB) Delete(id peer.ID) error

func (*PointersDB) DeleteAll

func (p *PointersDB) DeleteAll(purpose repo.Purpose) error

func (*PointersDB) ExecuteQuery

func (m *PointersDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*PointersDB) Get

func (p *PointersDB) Get(id peer.ID) *repo.Pointer

func (*PointersDB) GetAll

func (p *PointersDB) GetAll() ([]repo.Pointer, error)

func (*PointersDB) GetByPurpose

func (p *PointersDB) GetByPurpose(purpose repo.Purpose) ([]repo.Pointer, error)

func (*PointersDB) PrepareAndExecuteQuery

func (m *PointersDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*PointersDB) PrepareQuery

func (m *PointersDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*PointersDB) Put

func (p *PointersDB) Put(pointer repo.Pointer) error

type ProfileDB

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

func (*ProfileDB) GetAvatarId

func (c *ProfileDB) GetAvatarId() (*string, error)

func (*ProfileDB) GetTokens

func (c *ProfileDB) GetTokens() (*repo.CafeTokens, error)

func (*ProfileDB) GetUsername

func (c *ProfileDB) GetUsername() (*string, error)

func (*ProfileDB) SetAvatarId

func (c *ProfileDB) SetAvatarId(id string) error

func (*ProfileDB) SignIn

func (c *ProfileDB) SignIn(username string, tokens *repo.CafeTokens) error

func (*ProfileDB) SignOut

func (c *ProfileDB) SignOut() error

func (*ProfileDB) UpdateTokens

func (c *ProfileDB) UpdateTokens(tokens *repo.CafeTokens) error

type SQLiteDatastore

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

func Create

func Create(repoPath, password string) (*SQLiteDatastore, error)

func (*SQLiteDatastore) Blocks

func (d *SQLiteDatastore) Blocks() repo.BlockStore

func (*SQLiteDatastore) Close

func (d *SQLiteDatastore) Close()

func (*SQLiteDatastore) Config

func (d *SQLiteDatastore) Config() repo.ConfigStore

func (*SQLiteDatastore) Copy

func (d *SQLiteDatastore) Copy(dbPath string, password string) error

func (*SQLiteDatastore) Devices

func (d *SQLiteDatastore) Devices() repo.DeviceStore

func (*SQLiteDatastore) InitTables

func (d *SQLiteDatastore) InitTables(password string) error

func (*SQLiteDatastore) Notifications

func (d *SQLiteDatastore) Notifications() repo.NotificationStore

func (*SQLiteDatastore) OfflineMessages

func (d *SQLiteDatastore) OfflineMessages() repo.OfflineMessageStore

func (*SQLiteDatastore) Peers

func (d *SQLiteDatastore) Peers() repo.PeerStore

func (*SQLiteDatastore) PinRequests

func (d *SQLiteDatastore) PinRequests() repo.PinRequestStore

func (*SQLiteDatastore) Ping

func (d *SQLiteDatastore) Ping() error

func (*SQLiteDatastore) Pointers

func (d *SQLiteDatastore) Pointers() repo.PointerStore

func (*SQLiteDatastore) Profile

func (d *SQLiteDatastore) Profile() repo.ProfileStore

func (*SQLiteDatastore) Threads

func (d *SQLiteDatastore) Threads() repo.ThreadStore

type ThreadDB

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

func (*ThreadDB) Add

func (c *ThreadDB) Add(thread *repo.Thread) error

func (*ThreadDB) BeginTransaction

func (m *ThreadDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*ThreadDB) Count

func (c *ThreadDB) Count(query string) int

func (*ThreadDB) Delete

func (c *ThreadDB) Delete(id string) error

func (*ThreadDB) ExecuteQuery

func (m *ThreadDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*ThreadDB) Get

func (c *ThreadDB) Get(id string) *repo.Thread

func (*ThreadDB) List

func (c *ThreadDB) List(query string) []repo.Thread

func (*ThreadDB) PrepareAndExecuteQuery

func (m *ThreadDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*ThreadDB) PrepareQuery

func (m *ThreadDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*ThreadDB) UpdateHead

func (c *ThreadDB) UpdateHead(id string, head string) error

Jump to

Keyboard shortcuts

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