當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。