data

package
v0.0.0-...-7a19b54 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package data implements generic data structures and deletion of old data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIDValid

func IsIDValid(u *url.URL) bool

IsIDValid determines whether or not a URL can be a valid actor, object or activity ID.

func ParsePrivateKey

func ParsePrivateKey(privateKeyPemString string) (any, error)

ParsePrivateKey parses private keys.

Types

type GarbageCollector

type GarbageCollector struct {
	Domain string
	Config *cfg.Config
	DB     *sql.DB
}

func (*GarbageCollector) Run

func (gc *GarbageCollector) Run(ctx context.Context) error

Collect deletes old data.

type JSON

type JSON string

JSON is an precomputed JSON value

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

type OrderedMap

type OrderedMap[TK comparable, TV any] map[TK]valueAndIndex[TV]

OrderedMap is a map that maintains insertion order. Listing of keys (using OrderedMap.Keys) iterates over keys and allocates memory.

func (OrderedMap[TK, TV]) All

func (m OrderedMap[TK, TV]) All() iter.Seq2[TK, TV]

All iterates over key/value pairs in the map. All calls OrderedMap.Keys, therefore it allocates memory.

func (OrderedMap[TK, TV]) CollectKeys

func (m OrderedMap[TK, TV]) CollectKeys() []TK

CollectKeys returns a new slice of keys in the map.

func (OrderedMap[TK, TV]) Contains

func (m OrderedMap[TK, TV]) Contains(key TK) bool

Contains determines if the map contains a key.

func (OrderedMap[TK, TV]) Keys

func (m OrderedMap[TK, TV]) Keys() iter.Seq[TK]

Keys iterates over keys in the map. It allocates memory.

func (OrderedMap[TK, TV]) Store

func (m OrderedMap[TK, TV]) Store(key TK, value TV)

Store adds a key/value pair to the map if the map doesn't contain it already.

func (OrderedMap[TK, TV]) Values

func (m OrderedMap[TK, TV]) Values() iter.Seq[TV]

Values iterates over values in the map. Values calls OrderedMap.Keys, therefore it allocates memory.

Jump to

Keyboard shortcuts

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