storage

package
v0.0.0-...-45224f2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CHANGE_FILE_SQL = `UPDATE files SET file_path = ?, dir = ?, sha256 = ?, last_modify = ? WHERE id = ?;`
View Source
const CHANGE_MARK_SQL = `UPDATE mark SET mark=?, description=?, color=?, icon=? WHERE id=?;`
View Source
const CREATE_FILE_TABLE_SQL = `` /* 254-byte string literal not displayed */
View Source
const CREATE_MARK_TABLE_SQL = `` /* 248-byte string literal not displayed */
View Source
const CREATE_RELATION_TABLE_SQL = `` /* 362-byte string literal not displayed */
View Source
const DELETE_MARK_SQL = `DELETE FROM mark WHERE id = ?;`
View Source
const INSERT_FILE_MARK_SQL = `INSERT INTO file_marks (file_id, mark_id) VALUES(?,?);`
View Source
const INSERT_FILE_SQL = `INSERT INTO files (file_path, dir, sha256, last_modify) VALUES(?,?,?, ?);`
View Source
const INSERT_MARK_SQL = `INSERT INTO mark (mark, description, color, icon) VALUES(?,?,?,?);`
View Source
const QUERY_ALL_FILES_BY_DIR = `SELECT * FROM files WHERE dir = ?;`
View Source
const QUERY_FILE_ALL_MARKS_BY_ID_SQL = `SELECT m.* FROM mark m JOIN file_marks fm ON m.id = fm.mark_id WHERE fm.file_id = ?;`
View Source
const QUERY_FILE_ALL_MARKS_BY_PATH_SQL = `SELECT m.* FROM mark m JOIN file_marks fm ON m.id = fm.mark_id JOIN files f ON fm.file_id = f.id WHERE f.file_path = ?;`
View Source
const QUERY_FILE_BY_PATH = `SELECT * FROM files WHERE file_path = ?;`
View Source
const QUERY_FILE_BY_SHA256 = `SELECT * FROM files WHERE sha256 = ?;`
View Source
const QUERY_MARK_ALL_FILES_SQL = `SELECT f.* FROM files f JOIN file_marks fm ON f.id = fm.file_id WHERE fm.mark_id = ?;`
View Source
const QUERY_MARK_SQL = `SELECT * FROM mark WHERE id=?;`
View Source
const RENAME_MARK_SQL = `UPDATE mark SET mark=? WHERE id=?;`
View Source
const TABLE_FILE_NAME = "mark.db"

Variables

This section is empty.

Functions

func CalculateFileSHA256

func CalculateFileSHA256(filePath string) (string, error)

func ChangeFileInfo

func ChangeFileInfo(fileInfo *FileMark) bool

func ChangeMark

func ChangeMark(id int, mark *Mark) bool

func Connection

func Connection(dbfile string, callback func(db *sql.DB))

func CreateTable

func CreateTable()

func GetMarkTable

func GetMarkTable(root bool) string

func InsertFile

func InsertFile(path string) bool

func InsertMark

func InsertMark(data CreateMark) bool

func RemoveMark

func RemoveMark(id int) bool

func RenameMark

func RenameMark(id int, name string) bool

Types

type CreateMark

type CreateMark struct {
	Mark        string
	Description string
	Color       string
	Icon        string
}

type FileMark

type FileMark struct {
	ID         int
	Dir        string
	FilePath   string
	Marks      []string
	Sha256     string
	LastModify time.Time
	CreatedAt  time.Time
	ModifyAt   time.Time
}

func QueryFileByPath

func QueryFileByPath(filepath string) FileMark

func QueryFileBySHA256

func QueryFileBySHA256(sha256 string) FileMark

func QueryFilesByDir

func QueryFilesByDir(dir string) []FileMark

type Mark

type Mark struct {
	CreateMark
	Id        int
	Sort      int
	CreatedAt string
	ModifyAt  string
}

func QueryMark

func QueryMark(id int) (Mark, error)

func QueryMarks

func QueryMarks() []Mark

Jump to

Keyboard shortcuts

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