backup

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 23 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

Index

Constants

View Source
const DefaultDir = "backups"

Variables

This section is empty.

Functions

func ArchivePath

func ArchivePath(name string) string

func BackupToArchive

func BackupToArchive(out string, store imagestore.Store, dryRun, verbose bool) (string, error)

BackupToArchive writes a tar.gz backup. Empty out uses DefaultArchivePath.

func DefaultArchivePath

func DefaultArchivePath(t time.Time) string

DefaultArchivePath returns backups/backup-YYYYMMDD-HHMMSS.tar.gz (UTC).

func ListArchives

func ListArchives() ([]string, error)

ListArchives returns *.tar.gz names in backups/, newest first.

func RestoreFromArchive

func RestoreFromArchive(from string, store imagestore.Store,
	backupKey []byte, dryRun, verbose bool) error

RestoreFromArchive restores from a .tar.gz path (relative names use backups/). backupKey decrypts archive user fields. Empty uses config.DBEncryptionKey.

Types

type AdFacetRow

type AdFacetRow struct {
	AdRef int     `json:"ad_ref"`
	Key   string  `json:"key" db:"key"`
	Num   *int    `json:"num,omitempty" db:"num"`
	Text  *string `json:"text,omitempty" db:"text"`
}

type AdRow

type AdRow struct {
	Ref            int             `json:"ref"`
	CategoryID     int             `json:"category_id" db:"category_id"`
	Title          string          `json:"title" db:"title"`
	Description    string          `json:"description" db:"description"`
	CreatedAt      time.Time       `json:"created_at" db:"created_at"`
	ExpiresAt      time.Time       `json:"expires_at" db:"expires_at"`
	InactiveAt     *time.Time      `json:"inactive_at,omitempty" db:"inactive_at"`
	DeletedAt      *time.Time      `json:"deleted_at,omitempty" db:"deleted_at"`
	OwnerHash      string          `json:"owner_hash"`
	ImageCount     int             `json:"image_count" db:"image_count"`
	LocationRaw    *string         `json:"location_raw,omitempty"`
	Tags           string          `json:"tags" db:"tags"`
	Embedding      B64             `json:"embedding,omitempty"`
	VectorMetadata json.RawMessage `json:"vector_metadata,omitempty"`
}

type B64

type B64 []byte

func (B64) MarshalJSON

func (b B64) MarshalJSON() ([]byte, error)

func (*B64) UnmarshalJSON

func (b *B64) UnmarshalJSON(data []byte) error

type BookmarkRow

type BookmarkRow struct {
	UserHash     string    `json:"user_hash"`
	AdRef        int       `json:"ad_ref"`
	BookmarkedAt time.Time `json:"bookmarked_at" db:"bookmarked_at"`
}

type ConversationRow

type ConversationRow struct {
	Ref               int        `json:"ref"`
	AdRef             int        `json:"ad_ref"`
	OwnerHash         string     `json:"owner_hash"`
	InquirerHash      string     `json:"inquirer_hash"`
	OwnerHasUnread    int        `json:"owner_has_unread" db:"owner_has_unread"`
	InquirerHasUnread int        `json:"inquirer_has_unread" db:"inquirer_has_unread"`
	FlagRaiserHash    *string    `json:"flag_raiser_hash,omitempty"`
	FlagRaisedAt      *time.Time `json:"flag_raised_at,omitempty"`
}

type Counts

type Counts struct {
	Users             int `json:"users"`
	Locations         int `json:"locations"`
	Ads               int `json:"ads"`
	AdFacets          int `json:"ad_facets"`
	Bookmarks         int `json:"bookmarks"`
	UserAdClicks      int `json:"user_ad_clicks"`
	UserAdImageClicks int `json:"user_ad_image_clicks"`
	Conversations     int `json:"conversations"`
	Messages          int `json:"messages"`
	FlagOpinions      int `json:"flag_opinions"`
	Images            int `json:"images"`
	AccountPictures   int `json:"account_pictures"`
	Embeddings        int `json:"embeddings"`
}

type FlagOpinionRow added in v0.0.21

type FlagOpinionRow struct {
	ConversationRef  int       `json:"conversation_ref"`
	GeneratedAt      time.Time `json:"generated_at" db:"generated_at"`
	Summary          string    `json:"summary" db:"summary"`
	Assessment       int       `json:"assessment" db:"assessment"`
	AssessmentDetail string    `json:"assessment_detail" db:"assessment_detail"`
	Resolution       string    `json:"resolution" db:"resolution"`
	Reasoning        string    `json:"reasoning" db:"reasoning"`
}

type LocationRow

type LocationRow struct {
	RawText   string  `json:"raw_text" db:"raw_text"`
	City      string  `json:"city" db:"city"`
	AdminArea string  `json:"admin_area" db:"admin_area"`
	Country   string  `json:"country" db:"country"`
	Latitude  float64 `json:"latitude" db:"latitude"`
	Longitude float64 `json:"longitude" db:"longitude"`
}

type Manifest

type Manifest struct {
	CreatedAt time.Time `json:"created_at"`
	Counts    Counts    `json:"counts"`
}

type MessageRow

type MessageRow struct {
	ConversationRef int       `json:"conversation_ref"`
	SenderHash      string    `json:"sender_hash"`
	Content         string    `json:"content" db:"content"`
	CreatedAt       time.Time `json:"created_at" db:"created_at"`
}

type UserAdClickRow

type UserAdClickRow struct {
	AdRef         int       `json:"ad_ref"`
	UserHash      string    `json:"user_hash"`
	ClickCount    int       `json:"click_count" db:"click_count"`
	LastClickedAt time.Time `json:"last_clicked_at" db:"last_clicked_at"`
}

type UserAdImageClickRow

type UserAdImageClickRow struct {
	AdRef         int       `json:"ad_ref"`
	UserHash      string    `json:"user_hash"`
	ImageIndex    int       `json:"image_index" db:"image_index"`
	ClickCount    int       `json:"click_count" db:"click_count"`
	LastClickedAt time.Time `json:"last_clicked_at" db:"last_clicked_at"`
}

type UserRow

type UserRow struct {
	EncryptUserID     int        `json:"encrypt_user_id"`
	CreatedAt         time.Time  `json:"created_at" db:"created_at"`
	DeletedAt         *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
	IsAdmin           int        `json:"is_admin" db:"is_admin"`
	EncryptedName     B64        `json:"encrypted_name" db:"encrypted_name"`
	NameNonce         B64        `json:"name_nonce" db:"name_nonce"`
	NameHash          string     `json:"name_hash" db:"name_hash"`
	PasswordHash      string     `json:"password_hash" db:"password_hash"`
	PasswordSalt      string     `json:"password_salt" db:"password_salt"`
	PasswordAlgo      string     `json:"password_algo" db:"password_algo"`
	EncryptedPhone    B64        `json:"encrypted_phone" db:"encrypted_phone"`
	PhoneNonce        B64        `json:"phone_nonce" db:"phone_nonce"`
	PhoneHash         string     `json:"phone_hash" db:"phone_hash"`
	PhoneVerified     int        `json:"phone_verified" db:"phone_verified"`
	SMSOptedOut       int        `json:"sms_opted_out" db:"sms_opted_out"`
	LastSMSSentAt     *time.Time `json:"last_sms_sent_at,omitempty" db:"last_sms_sent_at"`
	HasAccountPicture int        `json:"has_account_picture" db:"has_account_picture"`
	AccountPictureURL *string    `json:"account_picture_url,omitempty" db:"account_picture_url"`
}

Jump to

Keyboard shortcuts

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