Skip to content

Instantly share code, notes, and snippets.

View amsokol's full-sized avatar

Aleksandr Sokolovskii amsokol

View GitHub Profile
@amsokol
amsokol / flutter-grpc-tutorial.go-server.pkg.protocol.grpc.server.go
Created January 13, 2019 10:02
flutter-grpc-tutorial.go-server.pkg.protocol.grpc.server.go
package grpc
import (
"context"
"log"
"net"
"google.golang.org/grpc"
"github.com/amsokol/flutter-grpc-tutorial/go-server/pkg/api/v1"
@amsokol
amsokol / flutter-grpc-tutorial.go-server.pkg.service.v1.chat.go
Last active January 13, 2019 10:03
flutter-grpc-tutorial.go-server.pkg.service.v1.chat.go
package v1
import (
"context"
"fmt"
"log"
"github.com/golang/protobuf/ptypes/empty"
"github.com/golang/protobuf/ptypes/wrappers"
syntax = "proto3";
package main;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "protoc-gen-gotag/tagger/tagger.proto";
message Data {
bool boolValue = 1;
TopologyOptions: []topology.Option{
topology.WithServerOptions(func(opts ...topology.ServerOption) []topology.ServerOption {
return []topology.ServerOption{
topology.WithRegistry(func(r *bsoncodec.Registry) *bsoncodec.Registry {
return reg
}),
}
}),
},
package main
import (
"context"
"log"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/wrappers"
package main
import (
"context"
"log"
"time"
"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo"
syntax = "proto3";
package main;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
message Data {
bool boolValue = 1;
package rest
import (
"context"
"net/http"
"os"
"os/signal"
"time"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
package middleware
import (
"net/http"
"strings"
"time"
"go.uber.org/zap"
)
package middleware
import (
"context"
"crypto/rand"
"encoding/base64"
"fmt"
"net/http"
"os"
"strings"