db

package
v0.0.0-...-691c0ea Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CallsBucket       = "Calls"
	GetExecutionSteps = "GetExecutionSteps"
	FixCode           = "FixCode"
	Compile           = "Compile"
	Format            = "Format"
	SourceCodeBucket  = "SourceCode"
	EmailsBucket      = "Emails"
	CodeKey           = "code"
	UpdatedAtKey      = "updated_at"
	EmailKey          = "email"
	SubscribedAtKey   = "subscribed_at"
)

Variables

This section is empty.

Functions

func FormatTimestamp

func FormatTimestamp(raw string) string

FormatTimestamp parses a stored timestamp and returns it in RFC822 format.

func ParseTimestamp

func ParseTimestamp(raw string) time.Time

ParseTimestamp parses timestamps stored in the DB. Handles both RFC822 (new format) and time.Now().String() (old format).

Types

type DB

type DB struct {
	*bolt.DB
}

func New

func New(dbPath string) (*DB, error)

New creates a new DB instance

func (*DB) DeleteEmailSubscription

func (db *DB) DeleteEmailSubscription(email string) error

DeleteEmailSubscription removes an email subscription

func (*DB) GetAllCallCounters

func (db *DB) GetAllCallCounters() (map[string]uint64, error)

GetAllCallCounters returns all API call counters

func (*DB) GetAllEmails

func (db *DB) GetAllEmails() ([]EmailEntry, error)

GetAllEmails returns all email subscriptions

func (*DB) GetAllSourceCodes

func (db *DB) GetAllSourceCodes() ([]SourceCodeEntry, error)

GetAllSourceCodes returns all stored source codes

func (*DB) IncrementCallCounter

func (db *DB) IncrementCallCounter(endpoint string) (uint64, error)

IncrementCallCounter increments the counter for API calls

func (*DB) SaveEmailSubscription

func (db *DB) SaveEmailSubscription(email string) error

SaveEmailSubscription stores an email subscription

func (*DB) SaveSourceCode

func (db *DB) SaveSourceCode(sourceCode string) error

SaveSourceCode stores the source code with its hash as the key

type EmailEntry

type EmailEntry struct {
	Email        string
	SubscribedAt string
}

EmailEntry represents a stored email subscription

type SourceCodeEntry

type SourceCodeEntry struct {
	Hash      string
	Code      string
	UpdatedAt string
}

SourceCodeEntry represents a stored source code entry

Jump to

Keyboard shortcuts

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