db

package
v0.0.0-...-4528677 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserPermissionUser  = 1
	UserPermissionAdmin = 100
)

定数

Variables

This section is empty.

Functions

func ConnectDB

func ConnectDB() (*dbr.Session, error)

ConnectDB DB接続

func ConnectDBRecheck

func ConnectDBRecheck(session *dbr.Session) (*dbr.Session, error)

func CreateBookHash

func CreateBookHash(filePath string) string

func CreateFolderHash

func CreateFolderHash(filePath string) string

func CreatePasswordHash

func CreatePasswordHash(password string) string

CreatePasswordHash パスワードからパスワードハッシュを生成する

func DeleteBook

func DeleteBook(id int64) error

func DeleteFolder

func DeleteFolder(id int64) error

func DeleteHistory

func DeleteHistory(userName string) error

func DeleteUser

func DeleteUser(id int64) error

func InsertBook

func InsertBook(folderHash string, filePath string, fileSize int, page int, modTime time.Time) error

func InsertFolder

func InsertFolder(filePath string, parentHash string, modTime time.Time) error

func InsertHistory

func InsertHistory(userName string, bookHash string, readPos int, reaction int, isExistUpdate bool) error

func InsertUser

func InsertUser(name string, password string, permission int) error

func UpdateBook

func UpdateBook(folderHash string, filePath string, fileSize int, page int, modTime time.Time) error

func UpdateFolder

func UpdateFolder(filePath string, parentHash string, modTime time.Time) error

func UpdateHistory

func UpdateHistory(userName string, bookHash string, readPos int, reaction int) error

func UpdateUser

func UpdateUser(name string, password string, permission int) error

Types

type BookTable

type BookTable struct {
	ID         int64     `db:"id"`
	Hash       string    `db:"hash"`
	FolderHash string    `db:"folder_hash"`
	FilePath   string    `db:"file_path"`
	FileSize   int       `db:"file_size"`
	Page       int       `db:"page"`
	ModTime    time.Time `db:"mod_time"`
}

BookTable アーカイブ情報テーブル

func SelectBook

func SelectBook(filePath string) (BookTable, error)

func SelectBookAll

func SelectBookAll() ([]BookTable, error)

func SelectBookFromHash

func SelectBookFromHash(hash string) (BookTable, error)

func SelectBookListFromFolder

func SelectBookListFromFolder(folderHash string) ([]BookTable, error)

type FolderTable

type FolderTable struct {
	ID         int64     `db:"id"`
	Hash       string    `db:"hash"`
	ParentHash string    `db:"parent_hash"`
	FilePath   string    `db:"file_path"`
	ModTime    time.Time `db:"mod_time"`
}

FolderTable アーカイブ情報テーブル

func SelectFolder

func SelectFolder(filePath string) (FolderTable, error)

func SelectFolderAll

func SelectFolderAll() ([]FolderTable, error)

func SelectFolderFromHash

func SelectFolderFromHash(hash string) (FolderTable, error)

func SelectFolderListFromParent

func SelectFolderListFromParent(parentHash string) ([]FolderTable, error)

func SelectFolderRoot

func SelectFolderRoot() (FolderTable, error)

type HistoryTable

type HistoryTable struct {
	ID       int64     `db:"id"`
	UserName string    `db:"user_name"`
	BookHash string    `db:"book_hash"`
	ReadPos  int       `db:"read_pos"`
	Reaction int       `db:"reaction"`
	ModTime  time.Time `db:"mod_time"`
}

情報テーブル

func SelectHistory

func SelectHistory(userName string, bookHash string) (HistoryTable, error)

type UserTable

type UserTable struct {
	ID         int64     `db:"id"`
	Name       string    `db:"name"`
	PassHash   string    `db:"passhash"`
	Permission int       `db:"permission"`
	CreatedAt  time.Time `db:"created_at"`
	UpdatedAt  time.Time `db:"updated_at"`
}

UserTable ユーザー情報テーブル

func SelectUser

func SelectUser(name string) (UserTable, error)

func SelectUserAll

func SelectUserAll() ([]UserTable, error)

Jump to

Keyboard shortcuts

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