recd

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package recd has various checks for record values.

Index

Constants

View Source
const (
	// Datetime MySQL format.
	Datetime = "2006-01-02T15:04:05Z"
	// UpdateID is a user id to use with the updatedby column.
	UpdateID = "b66dc282-a029-4e99-85db-2cf2892fffcc"
)

Variables

View Source
var (
	ErrDB       = errors.New("database handle pointer cannot be nil")
	ErrPointer  = errors.New("pointer value cannot be nil")
	ErrRawBytes = errors.New("rawbytes array is too small")
)

Functions

func ColLen

func ColLen(s *sql.ColumnType) string

func IsDemozoo

func IsDemozoo(b []sql.RawBytes) (bool, error)

IsDemozoo reports if a fetched demozoo file record is set to unapproved.

func NewApprove

func NewApprove(b []sql.RawBytes) (bool, error)

NewApprove reports if a new file record is set to unapproved.

func Queries

func Queries(db *sql.DB, w io.Writer, cfg conf.Config, v bool) error

queries parses all records waiting for approval skipping those that are missing expected data or assets such as thumbnails.

func ReverseInt

func ReverseInt(i int) (int, error)

ReverseInt swaps the direction of the value, 12345 would return 54321.

func Valid

func Valid(deletedat, updatedat sql.RawBytes) (bool, error)

func Verbose

func Verbose(w io.Writer, v bool, i any)

Types

type Record

type Record struct {
	C        int
	Save     bool
	Verbose  bool
	ID       uint
	UUID     string
	Filename string
	// contains filtered or unexported fields
}

func (*Record) Approve

func (r *Record) Approve(db *sql.DB) error

approve sets the record to be publically viewable.

func (*Record) AutoID

func (r *Record) AutoID(data string) uint

func (*Record) Check

func (r *Record) Check(w io.Writer, incoming string, values []sql.RawBytes, dir *directories.Dir) (bool, error)

func (*Record) CheckDownload added in v1.11.0

func (r *Record) CheckDownload(w io.Writer, incoming, path string) bool

func (*Record) CheckFileContent added in v1.11.0

func (r *Record) CheckFileContent(fc string) bool

func (*Record) CheckFileSize added in v1.11.0

func (r *Record) CheckFileSize(fs string) bool

func (*Record) CheckGroups

func (r *Record) CheckGroups(g1, g2 string) bool

func (*Record) CheckImage added in v1.11.0

func (r *Record) CheckImage(path string) bool

func (*Record) ImagePath

func (r *Record) ImagePath(path string) string

func (*Record) RecoverDownload added in v1.11.0

func (r *Record) RecoverDownload(w io.Writer, incoming, path string) bool

func (*Record) String

func (r *Record) String() string

func (*Record) Summary

func (r *Record) Summary(w io.Writer, rows int)

Jump to

Keyboard shortcuts

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