db

package
v0.0.0-...-e0ff526 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKey

func GetKey(sourceRepo, sourceBranch, targetRepo, targetBranch string, changeNum int64) string

GetKey sanitizes the source/target repo+branch with the change_num to construct an ID appropriate for Firestore. Eg: sourceRepo=skia, sourceBranch=chrome/m100, targetRepo=skia, targetBranch=android/next-release and changeNum=12 will return "skia-chrome-m100_skia-android-next-release_12".

Types

type CherrypickData

type CherrypickData struct {
	Created      time.Time `firestore:"created"`
	ChangeNumber int64     `firestore:"change_number"`
}

CherrypickData is the type that will be stored in FirestoreDB.

type FirestoreDB

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

FirestoreDB uses Cloud Firestore for storage.

func New

func New(ctx context.Context, ts oauth2.TokenSource, fsNamespace, fsProjectId string) (*FirestoreDB, error)

New returns an instance of FirestoreDB.

func (*FirestoreDB) GetFromDB

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

GetFromDB returns a CherrypickData 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, changeNum int64) error

PutInDB puts the specified CherrypickData into the DB.

Jump to

Keyboard shortcuts

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