db

package
v0.0.0-...-2ad74da Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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, repo string, prNumber int) (*PullRequestData, error)

GetFromDB returns a PullRequestData 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, repo string, prNumber int, prURL string, commented bool) error

PutInDB puts the specified pull request data into the DB.

func (*FirestoreDB) UpdateDB

func (f *FirestoreDB) UpdateDB(ctx context.Context, repo string, prNumber int, merged, abandoned bool) error

UpdateDB updates the PullRequestData document corresponding to the repo and prNumber.

type PullRequestData

type PullRequestData struct {
	Created           time.Time `firestore:"created"`
	PullRequestNumber int       `firestore:"pull_request_number"`
	PullRequestURL    string    `firestore:"pull_request_url"`

	Commented bool `firestore:"commented"`
	Merged    bool `firestore:"merged"`
	Abandoned bool `firestore:"abandoned"`
}

PullRequestData is the type that will be stored in FirestoreDB.

Jump to

Keyboard shortcuts

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