record

package
v1.11.13 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package record handles the proof database record.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrColVals = errors.New("each database value must have a matching table column")
	ErrID      = errors.New("record id cannot be empty")
	ErrProof   = errors.New("proof structure cannot be empty")
	ErrRecord  = errors.New("record structure cannot be empty")
	ErrPointer = errors.New("pointer value cannot be nil")
)

Functions

func Skip

func Skip(w io.Writer, s Proof, r Record) (bool, error)

Skip checks if the file of the proof exists.

func UpdateZipContent

func UpdateZipContent(db *sql.DB, w io.Writer, id, filename, content string, items int) error

UpdateZipContent sets the file_zip_content column to match content and platform to "image".

Types

type Proof added in v1.11.0

type Proof struct {
	Base      string          // Base is the relative path to file downloads which use UUID as filenames.
	BasePath  string          // BasePath to file downloads which use UUID as filenames.
	Columns   []string        // Column names.
	Count     int             // Count row index.
	Missing   int             // Missing UUID files count.
	Overwrite bool            // Overwrite flag (--overwrite) value.
	Total     int             // Total rows.
	Values    *[]sql.RawBytes // Values of the rows.
	// contains filtered or unexported fields
}

Proof data.

func Init added in v1.11.0

func Init(cfg conf.Config) (Proof, error)

func (*Proof) Summary added in v1.11.0

func (p *Proof) Summary(id string) string

Summary of the proofs.

type Record

type Record struct {
	ID   string // ID is a database generated, auto increment identifier.
	UUID string // Universal unique ID.
	File string // File is an absolute path to the hosted file download.
	Name string // Name is the original filename of the download.
}

Record of a file item.

func New

func New(values []sql.RawBytes, path string) Record

New returns a file record using values from the database.

func (Record) Approve

func (r Record) Approve(db *sql.DB, w io.Writer) error

Approve sets the record to be publically viewable.

func (Record) Iterate

func (r Record) Iterate(db *sql.DB, w io.Writer, cfg conf.Config, p Proof) error

Iterate through each stat value.

func (Record) Prefix

func (r Record) Prefix(w io.Writer, s *Proof) error

Prefix prints the stat count and record Id to stdout.

func (Record) Zip

func (r Record) Zip(db *sql.DB, w io.Writer, cfg conf.Config, overwrite bool) error

Zip reads an archive and saves the content to the database.

Jump to

Keyboard shortcuts

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