database

package
v0.0.0-...-65a89f1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EveryPage = 30

每一页有多少条消息。注意:如果修改该数值,同时需要修改 util.ts 中的 everyPage

View Source
const (
	SecretKeyName = "secret-key"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Path string
	DB   *sql.DB
}

func (*DB) AllIslands

func (db *DB) AllIslands() (islands []*Island, err error)

func (*DB) ChangePassword

func (db *DB) ChangePassword(newPwd string) error

func (*DB) CheckPassword

func (db *DB) CheckPassword(userInputPwd string) error

func (*DB) CreateIsland

func (db *DB) CreateIsland(island *Island) error

func (*DB) DeleteIsland

func (db *DB) DeleteIsland(id string) error

func (*DB) DeleteMessage

func (db *DB) DeleteMessage(msgID, islandID string) error

func (*DB) Exec

func (db *DB) Exec(query string, args ...interface{}) (err error)

func (*DB) GetIslandByID

func (db *DB) GetIslandByID(id string) (Island, error)

func (*DB) GetSecretKey

func (db *DB) GetSecretKey() ([]byte, error)

func (*DB) GetTitles

func (db *DB) GetTitles() (Titles, error)

func (*DB) MoreIslandMessages

func (db *DB) MoreIslandMessages(id string, datetime int64) ([]*Message, error)

MoreIslandMessages 获取指定小岛的更多消息。

func (*DB) MoreMessages

func (db *DB) MoreMessages(datetime int64, all bool) ([]*Message, error)

MoreMessages 获取公开小岛或全部小岛的更多消息。

func (*DB) Open

func (db *DB) Open(dbPath string) (err error)

func (*DB) PostMessage

func (db *DB) PostMessage(body, islandID string, islandHide bool) (*Message, error)

func (*DB) SearchMessages

func (db *DB) SearchMessages(pattern string, datetime int64) ([]*Message, error)

func (*DB) UpdateIsland

func (db *DB) UpdateIsland(island *Island) error

func (*DB) UpdateSubtitle

func (db *DB) UpdateSubtitle(subtitle string) error

func (*DB) UpdateTitle

func (db *DB) UpdateTitle(title string) error

func (*DB) UpdateTitles

func (db *DB) UpdateTitles(title, subtitle string) error

type Island

type Island = model.Island

type Message

type Message = model.Message

type Newsletter

type Newsletter = model.Newsletter

type Row

type Row interface {
	Scan(...interface{}) error
}

type SimpleMsg

type SimpleMsg = model.SimpleMsg

type TX

type TX interface {
	Exec(string, ...interface{}) (sql.Result, error)
	Query(string, ...interface{}) (*sql.Rows, error)
	QueryRow(string, ...interface{}) *sql.Row
}

type Titles

type Titles = model.Titles

Jump to

Keyboard shortcuts

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