Documentation ¶
Index ¶
- Variables
- func EmulatorOpts(addr string) []option.ClientOption
- type CloudDatabase
- func (d *CloudDatabase) Close() error
- func (d *CloudDatabase) Delete(ctx context.Context, keyHash authdb.KeyHash) (err error)
- func (d *CloudDatabase) Get(ctx context.Context, keyHash authdb.KeyHash) (_ *authdb.Record, err error)
- func (d *CloudDatabase) GetFullRecord(ctx context.Context, keyHash authdb.KeyHash) (_ *authdb.FullRecord, err error)
- func (d *CloudDatabase) HealthCheck(ctx context.Context) error
- func (d *CloudDatabase) Invalidate(ctx context.Context, keyHash authdb.KeyHash, reason string) (err error)
- func (d *CloudDatabase) Put(ctx context.Context, keyHash authdb.KeyHash, record *authdb.Record) (err error)
- func (d *CloudDatabase) Unpublish(ctx context.Context, keyHash authdb.KeyHash) (err error)
- type Config
Constants ¶
This section is empty.
Variables ¶
var ( // Error is a class of spannerauth errors. Error = errs.Class("spannerauth") )
Functions ¶
func EmulatorOpts ¶
func EmulatorOpts(addr string) []option.ClientOption
EmulatorOpts returns ClientOptions for Cloud Spanner Emulator.
Types ¶
type CloudDatabase ¶
type CloudDatabase struct {
// contains filtered or unexported fields
}
CloudDatabase represents a remote Cloud Spanner database that implements the Storage interface.
func Open ¶
Open returns initialized CloudDatabase connected to Cloud Spanner. If address is specified in config, it configures options for Cloud Spanner Emulator.
func (*CloudDatabase) Close ¶
func (d *CloudDatabase) Close() error
Close closes the remote Cloud Spanner database.
func (*CloudDatabase) Get ¶
func (d *CloudDatabase) Get(ctx context.Context, keyHash authdb.KeyHash) (_ *authdb.Record, err error)
Get retrieves the record from the remote Cloud Spanner database. It returns (nil, nil) if the key does not exist. If the record is invalid, the error contains why.
func (*CloudDatabase) GetFullRecord ¶ added in v1.69.0
func (d *CloudDatabase) GetFullRecord(ctx context.Context, keyHash authdb.KeyHash) (_ *authdb.FullRecord, err error)
GetFullRecord retrieves the record from the remote Cloud Spanner database. It returns (nil, nil) if the key does not exist.
func (*CloudDatabase) HealthCheck ¶
func (d *CloudDatabase) HealthCheck(ctx context.Context) error
HealthCheck ensures there's connectivity to the remote Cloud Spanner database and returns an error otherwise.
func (*CloudDatabase) Invalidate ¶ added in v1.67.0
func (d *CloudDatabase) Invalidate(ctx context.Context, keyHash authdb.KeyHash, reason string) (err error)
Invalidate invalidates the record.
type Config ¶
type Config struct { DatabaseName string `user:"true" help:"name of Cloud Spanner database in the form projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID"` CredentialsFilename string `user:"true" help:"credentials file with access to Cloud Spanner database"` // Address is used for Cloud Spanner Emulator in tests. Address string `internal:"true"` }
Config is config to configure the Cloud Spanner database.