Documentation
¶
Index ¶
- func InitDB(path string) error
- type Client
- func (c *Client) AddDirectory(parent int64, name string, mode int) (*Metadata, error)
- func (c *Client) Close()
- func (c *Client) CreateFile(parent int64, name string, mode int, url string, hash string) (*Metadata, error)
- func (c *Client) Delete(inode int64) error
- func (c *Client) ForceInsert(md *Metadata) error
- func (c *Client) Get(inode int64) (*Metadata, error)
- func (c *Client) GetChildren(parent int64) ([]Metadata, error)
- func (c *Client) GetFileCount() (int64, error)
- func (c *Client) GetRowCount() (int, error)
- func (c *Client) GetRows(limit int, offset int) ([]Metadata, error)
- func (c *Client) GetTotalSize() (int64, error)
- func (c *Client) Insert(md *Metadata) error
- func (c *Client) IsValidDatabase() bool
- func (c *Client) Search(parent int64, name string) (*Metadata, error)
- func (c *Client) Update(md *Metadata) error
- type Metadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is created when a new connection to the database is established Use NewClient() to create
func (*Client) AddDirectory ¶
AddDirectory insert row with type folder into the database
func (*Client) CreateFile ¶
func (c *Client) CreateFile(parent int64, name string, mode int, url string, hash string) (*Metadata, error)
CreateFile insert row with type file into the database
func (*Client) ForceInsert ¶
ForceInsert inserts metadata with provided inode, doesn't rely on autoincrement
func (*Client) GetChildren ¶
GetChildren returns files under the folder with specified inode
func (*Client) GetFileCount ¶
GetFileCount returns number of rows of type common.DrvFile
func (*Client) GetRowCount ¶
GetRowCount returns total number of rows
func (*Client) GetTotalSize ¶
func (*Client) IsValidDatabase ¶
IsValidDatabase checks whether `files` table exists
Click to show internal directories.
Click to hide internal directories.