当前位置: 首页>>代码示例>>Golang>>正文


Golang proto.SchemaDefinitionToProto函数代码示例

本文整理汇总了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
	})
}
开发者ID:haoqoo,项目名称:vitess,代码行数:12,代码来源:server.go

示例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
	})
}
开发者ID:haoqoo,项目名称:vitess,代码行数:18,代码来源:server.go

示例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
	})
}
开发者ID:haoqoo,项目名称:vitess,代码行数:11,代码来源:server.go

示例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
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:22,代码来源:client.go


注:本文中的github.com/youtube/vitess/go/vt/mysqlctl/proto.SchemaDefinitionToProto函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。