(ctx context.Context, source *pb.SourceVariant)
| 682 | } |
| 683 | |
| 684 | func (serv *MetadataServer) CreateSourceVariant(ctx context.Context, source *pb.SourceVariant) (*pb.Empty, error) { |
| 685 | serv.Logger.Infow("Creating Source Variant", "name", source.Name, "variant", source.Variant) |
| 686 | switch casted := source.Definition.(type) { |
| 687 | case *pb.SourceVariant_Transformation: |
| 688 | switch transformationType := casted.Transformation.Type.(type) { |
| 689 | case *pb.Transformation_SQLTransformation: |
| 690 | serv.Logger.Infow("Retreiving the sources from SQL Transformation", transformationType) |
| 691 | transformation := casted.Transformation.Type.(*pb.Transformation_SQLTransformation).SQLTransformation |
| 692 | qry := transformation.Query |
| 693 | numEscapes := strings.Count(qry, "{{") |
| 694 | sources := make([]*pb.NameVariant, numEscapes) |
| 695 | for i := 0; i < numEscapes; i++ { |
| 696 | split := strings.SplitN(qry, "{{", 2) |
| 697 | afterSplit := strings.SplitN(split[1], "}}", 2) |
| 698 | key := strings.TrimSpace(afterSplit[0]) |
| 699 | nameVariant := strings.SplitN(key, ".", 2) |
| 700 | sources[i] = &pb.NameVariant{Name: nameVariant[0], Variant: nameVariant[1]} |
| 701 | qry = afterSplit[1] |
| 702 | } |
| 703 | source.Definition.(*pb.SourceVariant_Transformation).Transformation.Type.(*pb.Transformation_SQLTransformation).SQLTransformation.Source = sources |
| 704 | } |
| 705 | } |
| 706 | return serv.meta.CreateSourceVariant(ctx, source) |
| 707 | } |
| 708 | |
| 709 | func (serv *MetadataServer) CreateEntity(ctx context.Context, entity *pb.Entity) (*pb.Empty, error) { |
| 710 | serv.Logger.Infow("Creating Entity", "entity", entity.Name) |
nothing calls this directly
no outgoing calls
no test coverage detected