db

package
v0.0.0-...-4bca2e0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NPM audits collection name.
	NpmAuditDataCol = "NpmAuditData"
	// Downloaded packages examiner collection name.
	DownloadedPackagesExaminerCol = "DownloadedPackagesExaminer"
)

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, ts oauth2.TokenSource, fsNamespace, fsProjectId, collectionName string) (types.NpmDB, error)

New returns an instance of FirestoreDB.

Types

type FirestoreDB

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

FirestoreDB uses Cloud Firestore for storage and implements the types.NpmDB interface.

func (*FirestoreDB) GetFromDB

func (f *FirestoreDB) GetFromDB(ctx context.Context, key string) (*types.NpmAuditData, error)

GetFromDB gets a NpmAuditData document snapshot from Firestore. If the document is not found then (nil, nil) is returned.

func (*FirestoreDB) PutInDB

func (f *FirestoreDB) PutInDB(ctx context.Context, key string, issueId int64, created time.Time) error

PutInDB puts NpmAuditData into the DB. If the specified key already exists then it is updated.

Jump to

Keyboard shortcuts

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