repository

package
v0.0.0-...-ca8b1a2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnixEpochJulianDay = 2440587.5
)

Variables

View Source
var JulianZeroTime = JulianDayToTime(0)

Functions

func DurationToMilliseconds

func DurationToMilliseconds(d time.Duration) int64

func JulianDayToTime

func JulianDayToTime(d float64) time.Time

JulianDayToTime converts a Julian day into a time.Time.

func JulianDayToTimestamp

func JulianDayToTimestamp(f float64) *timestamppb.Timestamp

func JulianNow

func JulianNow() float64

func MillisecondsToDuration

func MillisecondsToDuration(ms int64) time.Duration

func StmtBytes

func StmtBytes(stmt *sqlite.Stmt, colName string) []byte

func StmtJulianToTime

func StmtJulianToTime(stmt *sqlite.Stmt, colName string) time.Time

func StmtJulianToTimestamp

func StmtJulianToTimestamp(stmt *sqlite.Stmt, colName string) *timestamppb.Timestamp

func TimeToJulianDay

func TimeToJulianDay(t time.Time) float64

TimeToJulianDay converts a time.Time into a Julian day.

func TimestampJulian

func TimestampJulian(ts *timestamppb.Timestamp) float64

Types

type Database

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

func NewDatabase

func NewDatabase(ctx context.Context, dbFilename string, migrations []string) (*Database, error)

func (*Database) Close

func (db *Database) Close() error

func (*Database) ReadTX

func (db *Database) ReadTX(ctx context.Context, fn TxFn) (err error)

func (*Database) Reset

func (db *Database) Reset(ctx context.Context, shouldClear bool) (err error)

func (*Database) WriteTX

func (db *Database) WriteTX(ctx context.Context, fn TxFn) (err error)

func (*Database) WriteWithoutTx

func (db *Database) WriteWithoutTx(ctx context.Context, fn TxFn) error

type TxFn

type TxFn func(tx *sqlite.Conn) error

Jump to

Keyboard shortcuts

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