Documentation ¶
Index ¶
- Constants
- type BboltDB
- func (d *BboltDB) Close() error
- func (d *BboltDB) CountAll() (int, error)
- func (d *BboltDB) DeviceTokenByKey(key string) (string, error)
- func (d *BboltDB) GetMarkdownByKey(key string) (string, error)
- func (d *BboltDB) SaveDeviceTokenByKey(key, deviceToken string) (string, error)
- func (d *BboltDB) SaveMarkdown(content string) (string, error)
- type Database
- type EnvBase
- func (d *EnvBase) Close() error
- func (d *EnvBase) CountAll() (int, error)
- func (d *EnvBase) DeviceTokenByKey(key string) (string, error)
- func (d *EnvBase) GetMarkdownByKey(key string) (string, error)
- func (d *EnvBase) SaveDeviceTokenByKey(key, token string) (string, error)
- func (d *EnvBase) SaveMarkdown(content string) (string, error)
- type MySQL
- func (d *MySQL) Close() error
- func (d *MySQL) CountAll() (int, error)
- func (d *MySQL) DeviceTokenByKey(key string) (string, error)
- func (d *MySQL) GetMarkdownByKey(key string) (string, error)
- func (d *MySQL) SaveDeviceTokenByKey(key, token string) (string, error)
- func (d *MySQL) SaveMarkdown(content string) (string, error)
Constants ¶
View Source
const (
MARKDOWN_BUCKET_NAME = "markdown"
)
View Source
const (
MARKDOWN_DB_SCHEMA = "" +
"CREATE TABLE IF NOT EXISTS `markdown` (" +
" `id` INT UNSIGNED NOT NULL AUTO_INCREMENT," +
" `key` VARCHAR(255) NOT NULL, " +
" `content` TEXT NOT NULL," +
" `create_time` DATETIME(3) NOT NULL," +
" PRIMARY KEY (`id`), " +
" UNIQUE KEY `key` (`key`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"
)
View Source
const (
MARKDOWN_DIR = "markdown"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BboltDB ¶
type BboltDB struct { }
BboltDB implement Database interface with ETCD's bbolt
func (*BboltDB) DeviceTokenByKey ¶
DeviceTokenByKey get device token of specified key
func (*BboltDB) GetMarkdownByKey ¶
Get Markdown Content by key
func (*BboltDB) SaveDeviceTokenByKey ¶
SaveDeviceToken create or update device token of specified key
type Database ¶
type Database interface { CountAll() (int, error) //Get db records count DeviceTokenByKey(key string) (string, error) //Get specified device's token SaveDeviceTokenByKey(key, token string) (string, error) //Create or update specified devices's token GetMarkdownByKey(key string) (string, error) // Get Markdown Content by key SaveMarkdown(content string) (string, error) // Save Markdown Content Close() error //Close the database }
Database defines all of the db operation
func NewBboltdb ¶
func NewEnvBase ¶
func NewEnvBase() Database
type EnvBase ¶
type EnvBase struct { }
func (*EnvBase) GetMarkdownByKey ¶
Get Markdown Content by key
func (*EnvBase) SaveDeviceTokenByKey ¶
type MySQL ¶
type MySQL struct { }
func (*MySQL) GetMarkdownByKey ¶
Get Markdown Content by key
func (*MySQL) SaveDeviceTokenByKey ¶
Click to show internal directories.
Click to hide internal directories.