gcp

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FirestoreAPI

type FirestoreAPI struct {
	*base.Scoutr
	Filtering FirestoreFiltering
	Client    *firestore.Client
	// contains filtered or unexported fields
}

FirestoreAPI : API, based off of Scoutr, used to talk to Google Firestore

func (*FirestoreAPI) Close

func (api *FirestoreAPI) Close()

Close : Close all connections

func (FirestoreAPI) Create

func (api FirestoreAPI) Create(req models.Request, item map[string]string, validation map[string]utils.FieldValidation) error

Create : Create an item

func (FirestoreAPI) Delete

func (api FirestoreAPI) Delete(req models.Request, partitionKey map[string]string) error

Delete : Delete an item

func (FirestoreAPI) Get

func (api FirestoreAPI) Get(req models.Request, id string) (models.Record, error)

Get : Get an item from the table

func (FirestoreAPI) GetAuth

func (api FirestoreAPI) GetAuth(id string) (*models.User, error)

GetAuth : Fetch an auth identity from the collection Responses:

  • nil, nil: user does not exist
  • nil, error: error while fetching user
  • user, nil: found user

func (FirestoreAPI) GetGroup

func (api FirestoreAPI) GetGroup(id string) (*models.Group, error)

GetGroup : Fetch a group from the collection Responses:

  • nil, nil: group does not exist
  • nil, error: error while fetching group
  • user, nil: found group

func (FirestoreAPI) History

func (api FirestoreAPI) History(req models.Request, key string, value string, queryParams map[string]string, actions []string) ([]models.History, error)

History : Generate record history

func (*FirestoreAPI) Init

func (api *FirestoreAPI) Init(projectID string, options option.ClientOption)

Init : Initialize the Firestore client

func (FirestoreAPI) List

func (api FirestoreAPI) List(req models.Request) ([]models.Record, error)

List : List all records

func (FirestoreAPI) ListAuditLogs

func (api FirestoreAPI) ListAuditLogs(req models.Request, pathParams map[string]string, queryParams map[string]string) ([]models.AuditLog, error)

ListAuditLogs : List audit logs

func (FirestoreAPI) Search

func (api FirestoreAPI) Search(req models.Request, key string, values []string) ([]models.Record, error)

Search : Search items in the table

func (FirestoreAPI) Update

func (api FirestoreAPI) Update(req models.Request, partitionKey map[string]string, item map[string]string, validation map[string]utils.FieldValidation, auditAction string) (interface{}, error)

Update : Update an item

type FirestoreFiltering

type FirestoreFiltering struct {
	base.FilterBase
	Query firestore.Query
}

func (*FirestoreFiltering) And

func (f *FirestoreFiltering) And(conditions, condition interface{}) interface{}

And : Takes two conditions and performs an AND operation on them

func (*FirestoreFiltering) Between

func (f *FirestoreFiltering) Between(key string, value interface{}) interface{}

Between : Check for records that are between a low and high value

func (*FirestoreFiltering) Equals

func (f *FirestoreFiltering) Equals(key string, value interface{}) interface{}

Equals : Standard equals operation

func (*FirestoreFiltering) GreaterThan

func (f *FirestoreFiltering) GreaterThan(key string, value interface{}) interface{}

GreaterThan : Check if a value is greater than a string

func (*FirestoreFiltering) GreaterThanEqual

func (f *FirestoreFiltering) GreaterThanEqual(key string, value interface{}) interface{}

GreaterThanEqual : Check if a value is greater than a string

func (*FirestoreFiltering) In

func (f *FirestoreFiltering) In(key string, values interface{}) interface{}

In : Find all records with a list of values

func (*FirestoreFiltering) LessThan

func (f *FirestoreFiltering) LessThan(key string, value interface{}) interface{}

LessThan : Check if a value is greater than a string

func (*FirestoreFiltering) LessThanEqual

func (f *FirestoreFiltering) LessThanEqual(key string, value interface{}) interface{}

LessThanEqual : Check if a value is greater than a string

func (*FirestoreFiltering) Operations

func (f *FirestoreFiltering) Operations() base.OperationMap

Operations : Map of supported operations for this filter provider

Jump to

Keyboard shortcuts

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