Package database
Overview ▹
Index ▹
Variables
var Database_State_name = map[int32]string{ 0: "STATE_UNSPECIFIED", 1: "CREATING", 2: "READY", }
var Database_State_value = map[string]int32{ "STATE_UNSPECIFIED": 0, "CREATING": 1, "READY": 2, }
func RegisterDatabaseAdminServer ¶
func RegisterDatabaseAdminServer(s *grpc.Server, srv DatabaseAdminServer)
type CreateDatabaseMetadata ¶
Metadata type for the operation returned by [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
type CreateDatabaseMetadata struct {
// The database being created.
Database string `protobuf:"bytes,1,opt,name=database" json:"database,omitempty"`
}
func (*CreateDatabaseMetadata) Descriptor ¶
func (*CreateDatabaseMetadata) Descriptor() ([]byte, []int)
func (*CreateDatabaseMetadata) GetDatabase ¶
func (m *CreateDatabaseMetadata) GetDatabase() string
func (*CreateDatabaseMetadata) ProtoMessage ¶
func (*CreateDatabaseMetadata) ProtoMessage()
func (*CreateDatabaseMetadata) Reset ¶
func (m *CreateDatabaseMetadata) Reset()
func (*CreateDatabaseMetadata) String ¶
func (m *CreateDatabaseMetadata) String() string
type CreateDatabaseRequest ¶
The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
type CreateDatabaseRequest struct { // Required. The name of the instance that will serve the new database. // Values are of the form `projects/<project>/instances/<instance>`. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Required. A `CREATE DATABASE` statement, which specifies the ID of the // new database. The database ID must conform to the regular expression // `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. CreateStatement string `protobuf:"bytes,2,opt,name=create_statement,json=createStatement" json:"create_statement,omitempty"` // An optional list of DDL statements to run inside the newly created // database. Statements can create tables, indexes, etc. These // statements execute atomically with the creation of the database: // if there is an error in any statement, the database is not created. ExtraStatements []string `protobuf:"bytes,3,rep,name=extra_statements,json=extraStatements" json:"extra_statements,omitempty"` }
func (*CreateDatabaseRequest) Descriptor ¶
func (*CreateDatabaseRequest) Descriptor() ([]byte, []int)
func (*CreateDatabaseRequest) GetCreateStatement ¶
func (m *CreateDatabaseRequest) GetCreateStatement() string
func (*CreateDatabaseRequest) GetExtraStatements ¶
func (m *CreateDatabaseRequest) GetExtraStatements() []string
func (*CreateDatabaseRequest) GetParent ¶
func (m *CreateDatabaseRequest) GetParent() string
func (*CreateDatabaseRequest) ProtoMessage ¶
func (*CreateDatabaseRequest) ProtoMessage()
func (*CreateDatabaseRequest) Reset ¶
func (m *CreateDatabaseRequest) Reset()
func (*CreateDatabaseRequest) String ¶
func (m *CreateDatabaseRequest) String() string
type Database ¶
A Cloud Spanner database.
type Database struct { // Required. The name of the database. Values are of the form // `projects/<project>/instances/<instance>/databases/<database>`, // where `<database>` is as specified in the `CREATE DATABASE` // statement. This name can be passed to other API methods to // identify the database. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Output only. The current database state. State Database_State `protobuf:"varint,2,opt,name=state,enum=google.spanner.admin.database.v1.Database_State" json:"state,omitempty"` }
func (*Database) Descriptor ¶
func (*Database) Descriptor() ([]byte, []int)
func (*Database) GetName ¶
func (m *Database) GetName() string
func (*Database) GetState ¶
func (m *Database) GetState() Database_State
func (*Database) ProtoMessage ¶
func (*Database) ProtoMessage()
func (*Database) Reset ¶
func (m *Database) Reset()
func (*Database) String ¶
func (m *Database) String() string
type DatabaseAdminClient ¶
type DatabaseAdminClient interface { // Lists Cloud Spanner databases. ListDatabases(ctx context.Context, in *ListDatabasesRequest, opts ...grpc.CallOption) (*ListDatabasesResponse, error) // Creates a new Cloud Spanner database and starts to prepare it for serving. // The returned [long-running operation][google.longrunning.Operation] will // have a name of the format `<database_name>/operations/<operation_id>` and // can be used to track preparation of the database. The // [metadata][google.longrunning.Operation.metadata] field type is // [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The // [response][google.longrunning.Operation.response] field type is // [Database][google.spanner.admin.database.v1.Database], if successful. CreateDatabase(ctx context.Context, in *CreateDatabaseRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) // Gets the state of a Cloud Spanner database. GetDatabase(ctx context.Context, in *GetDatabaseRequest, opts ...grpc.CallOption) (*Database, error) // Updates the schema of a Cloud Spanner database by // creating/altering/dropping tables, columns, indexes, etc. The returned // [long-running operation][google.longrunning.Operation] will have a name of // the format `<database_name>/operations/<operation_id>` and can be used to // track execution of the schema change(s). The // [metadata][google.longrunning.Operation.metadata] field type is // [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response. UpdateDatabaseDdl(ctx context.Context, in *UpdateDatabaseDdlRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) // Drops (aka deletes) a Cloud Spanner database. DropDatabase(ctx context.Context, in *DropDatabaseRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) // Returns the schema of a Cloud Spanner database as a list of formatted // DDL statements. This method does not show pending schema updates, those may // be queried using the [Operations][google.longrunning.Operations] API. GetDatabaseDdl(ctx context.Context, in *GetDatabaseDdlRequest, opts ...grpc.CallOption) (*GetDatabaseDdlResponse, error) // Sets the access control policy on a database resource. Replaces any // existing policy. // // Authorization requires `spanner.databases.setIamPolicy` permission on // [resource][google.iam.v1.SetIamPolicyRequest.resource]. SetIamPolicy(ctx context.Context, in *google_iam_v11.SetIamPolicyRequest, opts ...grpc.CallOption) (*google_iam_v1.Policy, error) // Gets the access control policy for a database resource. Returns an empty // policy if a database exists but does not have a policy set. // // Authorization requires `spanner.databases.getIamPolicy` permission on // [resource][google.iam.v1.GetIamPolicyRequest.resource]. GetIamPolicy(ctx context.Context, in *google_iam_v11.GetIamPolicyRequest, opts ...grpc.CallOption) (*google_iam_v1.Policy, error) // Returns permissions that the caller has on the specified database resource. // // Attempting this RPC on a non-existent Cloud Spanner database will result in // a NOT_FOUND error if the user has `spanner.databases.list` permission on // the containing Cloud Spanner instance. Otherwise returns an empty set of // permissions. TestIamPermissions(ctx context.Context, in *google_iam_v11.TestIamPermissionsRequest, opts ...grpc.CallOption) (*google_iam_v11.TestIamPermissionsResponse, error) }
func NewDatabaseAdminClient ¶
func NewDatabaseAdminClient(cc *grpc.ClientConn) DatabaseAdminClient
type DatabaseAdminServer ¶
type DatabaseAdminServer interface { // Lists Cloud Spanner databases. ListDatabases(context.Context, *ListDatabasesRequest) (*ListDatabasesResponse, error) // Creates a new Cloud Spanner database and starts to prepare it for serving. // The returned [long-running operation][google.longrunning.Operation] will // have a name of the format `<database_name>/operations/<operation_id>` and // can be used to track preparation of the database. The // [metadata][google.longrunning.Operation.metadata] field type is // [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The // [response][google.longrunning.Operation.response] field type is // [Database][google.spanner.admin.database.v1.Database], if successful. CreateDatabase(context.Context, *CreateDatabaseRequest) (*google_longrunning.Operation, error) // Gets the state of a Cloud Spanner database. GetDatabase(context.Context, *GetDatabaseRequest) (*Database, error) // Updates the schema of a Cloud Spanner database by // creating/altering/dropping tables, columns, indexes, etc. The returned // [long-running operation][google.longrunning.Operation] will have a name of // the format `<database_name>/operations/<operation_id>` and can be used to // track execution of the schema change(s). The // [metadata][google.longrunning.Operation.metadata] field type is // [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response. UpdateDatabaseDdl(context.Context, *UpdateDatabaseDdlRequest) (*google_longrunning.Operation, error) // Drops (aka deletes) a Cloud Spanner database. DropDatabase(context.Context, *DropDatabaseRequest) (*google_protobuf2.Empty, error) // Returns the schema of a Cloud Spanner database as a list of formatted // DDL statements. This method does not show pending schema updates, those may // be queried using the [Operations][google.longrunning.Operations] API. GetDatabaseDdl(context.Context, *GetDatabaseDdlRequest) (*GetDatabaseDdlResponse, error) // Sets the access control policy on a database resource. Replaces any // existing policy. // // Authorization requires `spanner.databases.setIamPolicy` permission on // [resource][google.iam.v1.SetIamPolicyRequest.resource]. SetIamPolicy(context.Context, *google_iam_v11.SetIamPolicyRequest) (*google_iam_v1.Policy, error) // Gets the access control policy for a database resource. Returns an empty // policy if a database exists but does not have a policy set. // // Authorization requires `spanner.databases.getIamPolicy` permission on // [resource][google.iam.v1.GetIamPolicyRequest.resource]. GetIamPolicy(context.Context, *google_iam_v11.GetIamPolicyRequest) (*google_iam_v1.Policy, error) // Returns permissions that the caller has on the specified database resource. // // Attempting this RPC on a non-existent Cloud Spanner database will result in // a NOT_FOUND error if the user has `spanner.databases.list` permission on // the containing Cloud Spanner instance. Otherwise returns an empty set of // permissions. TestIamPermissions(context.Context, *google_iam_v11.TestIamPermissionsRequest) (*google_iam_v11.TestIamPermissionsResponse, error) }
type Database_State ¶
Indicates the current state of the database.
type Database_State int32
const ( // Not specified. Database_STATE_UNSPECIFIED Database_State = 0 // The database is still being created. Operations on the database may fail // with `FAILED_PRECONDITION` in this state. Database_CREATING Database_State = 1 // The database is fully created and ready for use. Database_READY Database_State = 2 )
func (Database_State) EnumDescriptor ¶
func (Database_State) EnumDescriptor() ([]byte, []int)
func (Database_State) String ¶
func (x Database_State) String() string
type DropDatabaseRequest ¶
The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
type DropDatabaseRequest struct {
// Required. The database to be dropped.
Database string `protobuf:"bytes,1,opt,name=database" json:"database,omitempty"`
}
func (*DropDatabaseRequest) Descriptor ¶
func (*DropDatabaseRequest) Descriptor() ([]byte, []int)
func (*DropDatabaseRequest) GetDatabase ¶
func (m *DropDatabaseRequest) GetDatabase() string
func (*DropDatabaseRequest) ProtoMessage ¶
func (*DropDatabaseRequest) ProtoMessage()
func (*DropDatabaseRequest) Reset ¶
func (m *DropDatabaseRequest) Reset()
func (*DropDatabaseRequest) String ¶
func (m *DropDatabaseRequest) String() string
type GetDatabaseDdlRequest ¶
The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
type GetDatabaseDdlRequest struct {
// Required. The database whose schema we wish to get.
Database string `protobuf:"bytes,1,opt,name=database" json:"database,omitempty"`
}
func (*GetDatabaseDdlRequest) Descriptor ¶
func (*GetDatabaseDdlRequest) Descriptor() ([]byte, []int)
func (*GetDatabaseDdlRequest) GetDatabase ¶
func (m *GetDatabaseDdlRequest) GetDatabase() string
func (*GetDatabaseDdlRequest) ProtoMessage ¶
func (*GetDatabaseDdlRequest) ProtoMessage()
func (*GetDatabaseDdlRequest) Reset ¶
func (m *GetDatabaseDdlRequest) Reset()
func (*GetDatabaseDdlRequest) String ¶
func (m *GetDatabaseDdlRequest) String() string
type GetDatabaseDdlResponse ¶
The response for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
type GetDatabaseDdlResponse struct { // A list of formatted DDL statements defining the schema of the database // specified in the request. Statements []string `protobuf:"bytes,1,rep,name=statements" json:"statements,omitempty"` }
func (*GetDatabaseDdlResponse) Descriptor ¶
func (*GetDatabaseDdlResponse) Descriptor() ([]byte, []int)
func (*GetDatabaseDdlResponse) GetStatements ¶
func (m *GetDatabaseDdlResponse) GetStatements() []string
func (*GetDatabaseDdlResponse) ProtoMessage ¶
func (*GetDatabaseDdlResponse) ProtoMessage()
func (*GetDatabaseDdlResponse) Reset ¶
func (m *GetDatabaseDdlResponse) Reset()
func (*GetDatabaseDdlResponse) String ¶
func (m *GetDatabaseDdlResponse) String() string
type GetDatabaseRequest ¶
The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
type GetDatabaseRequest struct { // Required. The name of the requested database. Values are of the form // `projects/<project>/instances/<instance>/databases/<database>`. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` }
func (*GetDatabaseRequest) Descriptor ¶
func (*GetDatabaseRequest) Descriptor() ([]byte, []int)
func (*GetDatabaseRequest) GetName ¶
func (m *GetDatabaseRequest) GetName() string
func (*GetDatabaseRequest) ProtoMessage ¶
func (*GetDatabaseRequest) ProtoMessage()
func (*GetDatabaseRequest) Reset ¶
func (m *GetDatabaseRequest) Reset()
func (*GetDatabaseRequest) String ¶
func (m *GetDatabaseRequest) String() string
type ListDatabasesRequest ¶
The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
type ListDatabasesRequest struct { // Required. The instance whose databases should be listed. // Values are of the form `projects/<project>/instances/<instance>`. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Number of databases to be returned in the response. If 0 or less, // defaults to the server's maximum allowed page size. PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` // If non-empty, `page_token` should contain a // [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] from a // previous [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` }
func (*ListDatabasesRequest) Descriptor ¶
func (*ListDatabasesRequest) Descriptor() ([]byte, []int)
func (*ListDatabasesRequest) GetPageSize ¶
func (m *ListDatabasesRequest) GetPageSize() int32
func (*ListDatabasesRequest) GetPageToken ¶
func (m *ListDatabasesRequest) GetPageToken() string
func (*ListDatabasesRequest) GetParent ¶
func (m *ListDatabasesRequest) GetParent() string
func (*ListDatabasesRequest) ProtoMessage ¶
func (*ListDatabasesRequest) ProtoMessage()
func (*ListDatabasesRequest) Reset ¶
func (m *ListDatabasesRequest) Reset()
func (*ListDatabasesRequest) String ¶
func (m *ListDatabasesRequest) String() string
type ListDatabasesResponse ¶
The response for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
type ListDatabasesResponse struct { // Databases that matched the request. Databases []*Database `protobuf:"bytes,1,rep,name=databases" json:"databases,omitempty"` // `next_page_token` can be sent in a subsequent // [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] call to fetch more // of the matching databases. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` }
func (*ListDatabasesResponse) Descriptor ¶
func (*ListDatabasesResponse) Descriptor() ([]byte, []int)
func (*ListDatabasesResponse) GetDatabases ¶
func (m *ListDatabasesResponse) GetDatabases() []*Database
func (*ListDatabasesResponse) GetNextPageToken ¶
func (m *ListDatabasesResponse) GetNextPageToken() string
func (*ListDatabasesResponse) ProtoMessage ¶
func (*ListDatabasesResponse) ProtoMessage()
func (*ListDatabasesResponse) Reset ¶
func (m *ListDatabasesResponse) Reset()
func (*ListDatabasesResponse) String ¶
func (m *ListDatabasesResponse) String() string
type UpdateDatabaseDdlMetadata ¶
Metadata type for the operation returned by [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
type UpdateDatabaseDdlMetadata struct { // The database being modified. Database string `protobuf:"bytes,1,opt,name=database" json:"database,omitempty"` // For an update this list contains all the statements. For an // individual statement, this list contains only that statement. Statements []string `protobuf:"bytes,2,rep,name=statements" json:"statements,omitempty"` // Reports the commit timestamps of all statements that have // succeeded so far, where `commit_timestamps[i]` is the commit // timestamp for the statement `statements[i]`. CommitTimestamps []*google_protobuf3.Timestamp `protobuf:"bytes,3,rep,name=commit_timestamps,json=commitTimestamps" json:"commit_timestamps,omitempty"` }
func (*UpdateDatabaseDdlMetadata) Descriptor ¶
func (*UpdateDatabaseDdlMetadata) Descriptor() ([]byte, []int)
func (*UpdateDatabaseDdlMetadata) GetCommitTimestamps ¶
func (m *UpdateDatabaseDdlMetadata) GetCommitTimestamps() []*google_protobuf3.Timestamp
func (*UpdateDatabaseDdlMetadata) GetDatabase ¶
func (m *UpdateDatabaseDdlMetadata) GetDatabase() string
func (*UpdateDatabaseDdlMetadata) GetStatements ¶
func (m *UpdateDatabaseDdlMetadata) GetStatements() []string
func (*UpdateDatabaseDdlMetadata) ProtoMessage ¶
func (*UpdateDatabaseDdlMetadata) ProtoMessage()
func (*UpdateDatabaseDdlMetadata) Reset ¶
func (m *UpdateDatabaseDdlMetadata) Reset()
func (*UpdateDatabaseDdlMetadata) String ¶
func (m *UpdateDatabaseDdlMetadata) String() string
type UpdateDatabaseDdlRequest ¶
Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to the database schema at some point (or points) in the future. The server checks that the statements are executable (syntactically valid, name tables that exist, etc.) before enqueueing them, but they may still fail upon later execution (e.g., if a statement from another batch of statements is applied first and it conflicts in some way, or if there is some data-related problem like a `NULL` value in a column to which `NOT NULL` would be added). If a statement fails, all subsequent statements in the batch are automatically cancelled.
Each batch of statements is assigned a name which can be used with the [Operations][google.longrunning.Operations] API to monitor progress. See the [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more details.
type UpdateDatabaseDdlRequest struct { // Required. The database to update. Database string `protobuf:"bytes,1,opt,name=database" json:"database,omitempty"` // DDL statements to be applied to the database. Statements []string `protobuf:"bytes,2,rep,name=statements" json:"statements,omitempty"` // If empty, the new update request is assigned an // automatically-generated operation ID. Otherwise, `operation_id` // is used to construct the name of the resulting // [Operation][google.longrunning.Operation]. // // Specifying an explicit operation ID simplifies determining // whether the statements were executed in the event that the // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] call is replayed, // or the return value is otherwise lost: the [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] and // `operation_id` fields can be combined to form the // [name][google.longrunning.Operation.name] of the resulting // [longrunning.Operation][google.longrunning.Operation]: `<database>/operations/<operation_id>`. // // `operation_id` should be unique within the database, and must be // a valid identifier: `[a-z][a-z0-9_]*`. Note that // automatically-generated operation IDs always begin with an // underscore. If the named operation already exists, // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns // `ALREADY_EXISTS`. OperationId string `protobuf:"bytes,3,opt,name=operation_id,json=operationId" json:"operation_id,omitempty"` }
func (*UpdateDatabaseDdlRequest) Descriptor ¶
func (*UpdateDatabaseDdlRequest) Descriptor() ([]byte, []int)
func (*UpdateDatabaseDdlRequest) GetDatabase ¶
func (m *UpdateDatabaseDdlRequest) GetDatabase() string
func (*UpdateDatabaseDdlRequest) GetOperationId ¶
func (m *UpdateDatabaseDdlRequest) GetOperationId() string
func (*UpdateDatabaseDdlRequest) GetStatements ¶
func (m *UpdateDatabaseDdlRequest) GetStatements() []string
func (*UpdateDatabaseDdlRequest) ProtoMessage ¶
func (*UpdateDatabaseDdlRequest) ProtoMessage()
func (*UpdateDatabaseDdlRequest) Reset ¶
func (m *UpdateDatabaseDdlRequest) Reset()
func (*UpdateDatabaseDdlRequest) String ¶
func (m *UpdateDatabaseDdlRequest) String() string