common

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package common for all common functionality and utilities

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdout = log.New(os.Stdout, "", 0)
	Stderr = log.New(os.Stderr, "", 0)
)

Functions

func BackupDB added in v0.3.0

func BackupDB(writer io.Writer) error

func BeginTarnsaction added in v0.1.4

func BeginTarnsaction(db *sql.DB) (*sql.Tx, error)

func ClearDB

func ClearDB()

func CloseDB added in v0.2.0

func CloseDB()

func CopyFile added in v0.2.0

func CopyFile(src, dst string) error

CopyFile copies content from `src` file into `dst` file

func Decrypt

func Decrypt(encryptedB64 string, password string) (string, error)

func Encrypt

func Encrypt(plaintext string, password string) (string, error)

func EqualStringPtrs

func EqualStringPtrs(s1, s2 *string) bool

func EqualTimePtrs

func EqualTimePtrs(t1, t2 *time.Time) bool

func Fail

func Fail(message string, args ...any)

func FailOn

func FailOn(err error)

func FormatTimePtr

func FormatTimePtr(t *time.Time) *string

func GetDB added in v0.1.4

func GetDB() (*sql.DB, error)

func GetDBPath added in v0.2.0

func GetDBPath() string

func GetDefaultBackupPath added in v0.3.0

func GetDefaultBackupPath() string

func GetVersion

func GetVersion() string

GetVersion returns the version string. If version was set via SetVersion (goreleaser build), it returns that. Otherwise, it attempts to get the version from git tags.

func NormalizePath added in v0.2.0

func NormalizePath(path string) string

NormalizePath fills in home directory if needed, and make path into absolute path

func Quiet

func Quiet(enable bool)

func SetVersion

func SetVersion(v string)

SetVersion sets the version string (typically injected by goreleaser at build time)

func ValidateSqliteFile added in v0.2.0

func ValidateSqliteFile(path string) error

func Warn

func Warn(msg string)

Types

type Config

type Config struct {
	PruneHistoryAfterDays int `json:"pruneHistoryAfterDays" yaml:"prune-history-after-days,omitempty"`
	HistoryLength         int `json:"historyLength" yaml:"history-length,omitempty"`
}

func ReadConfig

func ReadConfig() Config

func (Config) String

func (c Config) String() string

Jump to

Keyboard shortcuts

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