本文整理汇总了Golang中github.com/youtube/vitess/go/vt/mysqlctl/proto.SchemaDefinitionToProto函数的典型用法代码示例。如果您正苦于以下问题:Golang SchemaDefinitionToProto函数的具体用法?Golang SchemaDefinitionToProto怎么用?Golang SchemaDefinitionToProto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SchemaDefinitionToProto函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PreflightSchema
func (s *server) PreflightSchema(ctx context.Context, request *pb.PreflightSchemaRequest) (*pb.PreflightSchemaResponse, error) {
ctx = callinfo.GRPCCallInfo(ctx)
response := &pb.PreflightSchemaResponse{}
return response, s.agent.RPCWrapLockAction(ctx, actionnode.TabletActionPreflightSchema, request, response, true, func() error {
scr, err := s.agent.PreflightSchema(ctx, request.Change)
if err == nil {
response.BeforeSchema = myproto.SchemaDefinitionToProto(scr.BeforeSchema)
response.AfterSchema = myproto.SchemaDefinitionToProto(scr.AfterSchema)
}
return err
})
}
示例2: ApplySchema
func (s *server) ApplySchema(ctx context.Context, request *pb.ApplySchemaRequest) (*pb.ApplySchemaResponse, error) {
ctx = callinfo.GRPCCallInfo(ctx)
response := &pb.ApplySchemaResponse{}
return response, s.agent.RPCWrapLockAction(ctx, actionnode.TabletActionApplySchema, request, response, true, func() error {
scr, err := s.agent.ApplySchema(ctx, &myproto.SchemaChange{
Sql: request.Sql,
Force: request.Force,
AllowReplication: request.AllowReplication,
BeforeSchema: myproto.ProtoToSchemaDefinition(request.BeforeSchema),
AfterSchema: myproto.ProtoToSchemaDefinition(request.AfterSchema),
})
if err == nil {
response.BeforeSchema = myproto.SchemaDefinitionToProto(scr.BeforeSchema)
response.AfterSchema = myproto.SchemaDefinitionToProto(scr.AfterSchema)
}
return err
})
}
示例3: GetSchema
func (s *server) GetSchema(ctx context.Context, request *pb.GetSchemaRequest) (*pb.GetSchemaResponse, error) {
ctx = callinfo.GRPCCallInfo(ctx)
response := &pb.GetSchemaResponse{}
return response, s.agent.RPCWrap(ctx, actionnode.TabletActionGetSchema, request, response, func() error {
sd, err := s.agent.GetSchema(ctx, request.Tables, request.ExcludeTables, request.IncludeViews)
if err == nil {
response.SchemaDefinition = myproto.SchemaDefinitionToProto(sd)
}
return err
})
}
示例4: ApplySchema
// ApplySchema is part of the tmclient.TabletManagerClient interface
func (client *Client) ApplySchema(ctx context.Context, tablet *topo.TabletInfo, change *myproto.SchemaChange) (*myproto.SchemaChangeResult, error) {
cc, c, err := client.dial(ctx, tablet)
if err != nil {
return nil, err
}
defer cc.Close()
response, err := c.ApplySchema(ctx, &pb.ApplySchemaRequest{
Sql: change.Sql,
Force: change.Force,
AllowReplication: change.AllowReplication,
BeforeSchema: myproto.SchemaDefinitionToProto(change.BeforeSchema),
AfterSchema: myproto.SchemaDefinitionToProto(change.AfterSchema),
})
if err != nil {
return nil, err
}
return &myproto.SchemaChangeResult{
BeforeSchema: myproto.ProtoToSchemaDefinition(response.BeforeSchema),
AfterSchema: myproto.ProtoToSchemaDefinition(response.AfterSchema),
}, nil
}