pgfs

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: GPL-2.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

vlbeaudoin/pgfs

Lab for file storage in PostgreSQL using BYTEA type.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHash added in v0.4.0

func ComputeHash(content []byte) ([]byte, error)

func ComputeHashFromOS added in v0.2.0

func ComputeHashFromOS(path string) ([]byte, error)

func PrintFileInfo

func PrintFileInfo(name string) error

func Revision

func Revision() string

Types

type DBClient

type DBClient struct {
	Pool *pgxpool.Pool
}

func (*DBClient) CompareHash added in v0.2.0

func (c *DBClient) CompareHash(id uuid.UUID, hash []byte) (bool, error)

func (*DBClient) CompareHashFromOS added in v0.2.0

func (c *DBClient) CompareHashFromOS(id uuid.UUID, path string) (bool, error)

func (*DBClient) CreateFile

func (c *DBClient) CreateFile(name string, contentType string, content []byte) (uuid.UUID, error)

func (*DBClient) CreateFileFromOS

func (c *DBClient) CreateFileFromOS(name string) (uuid.UUID, error)

func (*DBClient) DeleteFiles

func (c *DBClient) DeleteFiles(ids ...uuid.UUID) (deletedIDs []uuid.UUID, err error)

func (*DBClient) DownloadFile

func (c *DBClient) DownloadFile(id uuid.UUID, path string, overwrite bool) (length int, version int, name string, err error)

Downloads the specified file from the database.

If path is "", dowloads to temporary directory specified by TEMPDIR. Otherwise, downloads to specified directory or file.

func (*DBClient) Init

func (c *DBClient) Init() error

func (*DBClient) ListFiles

func (c *DBClient) ListFiles() (files []FileInfo, err error)

func (*DBClient) ListVersions

func (c *DBClient) ListVersions() (map[uuid.UUID]int, error)

func (*DBClient) PrintFileInfo deprecated

func (c *DBClient) PrintFileInfo(name string) error

Deprecated: use PrintFileInfo function

func (*DBClient) ReadFileInfo

func (c *DBClient) ReadFileInfo(id uuid.UUID) (info FileInfo, err error)

func (*DBClient) UpdateFile

func (c *DBClient) UpdateFile(id uuid.UUID, name string, contentType string, content []byte) (uuid.UUID, error)

func (*DBClient) UpdateFileFromOS

func (c *DBClient) UpdateFileFromOS(id uuid.UUID, name string) (uuid.UUID, error)

type FileBuffer

type FileBuffer struct {
	FileInfo
	Content []byte
}

type FileInfo

type FileInfo struct {
	ID          uuid.UUID
	Name        string
	Version     int
	ContentType string
	Length      int
}

type FilePatch

type FilePatch struct {
	Name        *string
	ContentType *string
	Content     []byte
}

Directories

Path Synopsis
cmd
pgfs command

Jump to

Keyboard shortcuts

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