func main()

in e2e-checksum/main.go [62:91]


func main() {
	type Entity struct {
		Firstname string
		Lastname  string
	}

	ctx := context.Background()
	projectID := "grpc-gcp"
	opts := []option.ClientOption{
		option.WithGRPCDialOption(grpc.WithCodec(&myCodec{protoCodec: encoding.GetCodec(protoCodec.Name)})),
		option.WithGRPCDialOption(grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, ""))),
		//option.WithEndpoint("stubby-e2e-generic-service-test.sandbox.googleapis.com:443"),
	}
	client, err := datastore.NewClient(ctx, projectID, opts...)
	if err != nil {
		log.Fatalf("Failed to create firestore client: %v", err)
	}
	kind := "Person"
	name := "weiranf"
	key := datastore.NameKey(kind, name, nil)

	e := Entity{
		Firstname: "Weiran",
		Lastname:  "Fang",
	}

	if _, err := client.Put(ctx, key, &e); err != nil {
		log.Fatalf("client.Put failed: %v", err)
	}
}