filepg

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 11 Imported by: 0 modules, 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.

Documentation

Overview

Package filepg stores Files in PostgreSQL: metadata in source_files and content in large objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(pool *pgunit.Pool) *Store

func (*Store) Create

func (s *Store) Create(ctx context.Context, tenantID string, write func(io.Writer) (files.Upload, error)) (files.File, error)

Create writes the content into a large object and stores the File and its write audit in the same transaction, so a failed upload leaves nothing.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, tenantID, fileID string) error

Delete removes the row and its large object and records the write audit in one transaction.

func (*Store) Get

func (s *Store) Get(ctx context.Context, tenantID, fileID string) (files.File, error)

func (*Store) List

func (s *Store) List(ctx context.Context, tenantID string, query files.ListQuery) (files.Page, error)

List resolves the cursor and reads the page from one snapshot.

func (*Store) Read

func (s *Store) Read(ctx context.Context, tenantID, fileID string, consume func(files.File, io.Reader) error) error

Read streams the content from a snapshot taken with the metadata, so a concurrent Delete never truncates it.

Jump to

Keyboard shortcuts

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