Generic datastore service with basic indexing and querying capabilities, ts client generation (#52)

This commit is contained in:
Janos Dobronszki
2021-02-03 13:20:07 +00:00
committed by GitHub
parent c19bf17fb5
commit a102d9e5f3
32 changed files with 5010 additions and 626 deletions

View File

@@ -1,5 +1,10 @@
name: Generate docs
on: [push]
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- master
jobs:
docs:
@@ -66,3 +71,31 @@ jobs:
BRANCH: gh-pages
FOLDER: services/docs
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
- name: Generate package
working-directory: services
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
go run cmd/tsgen/main.go .
# publish to github first under micro/services
# .npmrc has settings for it
- uses: JS-DevTools/npm-publish@v1
with:
access: public
package: services/clients/ts/package.json
token: ${{ secrets.NPM_TOKEN }}
# publish to npm m3o/services
- name: Change npm settings
working-directory: services
run: |
rm clients/ts/.npmrc
sed -i 's/micro/m3o/g' clients/ts/package.json
- uses: JS-DevTools/npm-publish@v1
with:
access: public
package: services/clients/ts/package.json
token: ${{ secrets.NPM_SITE_TOKEN }}

View File

@@ -7,7 +7,11 @@ init:
go get github.com/micro/micro/v3/cmd/protoc-gen-micro
.PHONY: proto
proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/chats.proto
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/chats.proto
docs:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/chats.proto
@redoc-cli bundle api-protobuf.json
.PHONY: build
build:

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.13.0
// protoc-gen-go v1.25.0
// protoc v3.6.1
// source: proto/chats.proto
package chats

0
clients/skip Normal file
View File

1
clients/ts/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
dist

1
clients/ts/.npmrc Normal file
View File

@@ -0,0 +1 @@
registry=https://npm.pkg.github.com/micro

21
clients/ts/package.json Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "@micro/services",
"version": "1.0.1",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/micro/services"
},
"author": "",
"license": "ISC",
"scripts": {
"build": "tsc",
"prepare": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"typescript": "^2.7.2"
}
}

15
clients/ts/tsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["es2017", "es7", "es6", "dom"],
"declaration": true,
"outDir": "dist",
"strict": true,
"esModuleInterop": true
},
"exclude": [
"node_modules",
"dist"
]
}

View File

@@ -157,7 +157,7 @@ var servicesToTags = map[string][]string{
"posts": []string{"Headless CMS"},
"tags": []string{"Headless CMS"},
"feeds": []string{"Headless CMS"},
"chat": []string{"Communications"},
"datastore": []string{"Backend"},
"geocoding": []string{"Logistics"},
"places": []string{"Logistics"},
"routing": []string{"Logistics"},
@@ -214,7 +214,7 @@ func saveSpec(originalMarkDown []byte, contentDir, serviceName string, spec *ope
if len(parts) <= 1 {
return string(bs)
}
parts[len(parts)-1] = strings.Repeat(" ", prepend) + parts[len(parts)-1]
parts[len(parts)-1] = parts[len(parts)-1]
return strings.Join(parts, "\n")
}
}
@@ -265,6 +265,13 @@ func schemaToMap(spec *openapi3.SchemaRef, schemas map[string]*openapi3.SchemaRe
k = strcase.SnakeCase(k)
//v.Value.
if v.Value.Type == "object" {
// @todo identify what is a slice and what is not!
// currently the openapi converter messes this up
// see redoc html output
ret[k] = recurse(v.Value.Properties)
continue
}
if v.Value.Type == "array" {
// @todo identify what is a slice and what is not!
// currently the openapi converter messes this up
// see redoc html output

154
cmd/tsgen/gen_test.go Normal file
View File

@@ -0,0 +1,154 @@
package main
import (
"encoding/json"
"testing"
"github.com/getkin/kin-openapi/openapi3"
)
type tspec struct {
openapi string
tsresult string
key string
}
var cases = []tspec{
{
openapi: `{
"components": {
"schemas": {
"QueryRequest": {
"description": "Query posts. Acts as a listing when no id or slug provided.\n Gets a single post by id or slug if any of them provided.",
"properties": {
"id": {
"type": "string"
},
"limit": {
"format": "int64",
"type": "number"
},
"offset": {
"format": "int64",
"type": "number"
},
"slug": {
"type": "string"
},
"tag": {
"type": "string"
}
},
"title": "QueryRequest",
"type": "object"
}
}
}
}`,
key: "QueryRequest",
tsresult: `export interface QueryRequest {
limit?: number;
offset?: number;
slug?: number;
tag?: number;
id?: number;
}`,
},
{
openapi: `{"components": { "schemas": {
"QueryResponse": {
"properties": {
"posts": {
"items": {
"properties": {
"author": {
"type": "string"
},
"content": {
"type": "string"
},
"created": {
"format": "int64",
"type": "number"
},
"id": {
"type": "string"
},
"image": {
"type": "string"
},
"metadata": {
"items": {
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"slug": {
"type": "string"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"type": "string"
},
"updated": {
"format": "int64",
"type": "number"
}
},
"type": "object"
},
"type": "array"
}
},
"title": "QueryResponse",
"type": "object"
}}}}`,
key: "QueryResponse",
tsresult: `
export interface QueryResponse {
posts?: {
metadata?: {
value?: string;
key?: string;
}[];
slug?: string;
title?: string;
content?: string;
created?: number;
id?: string;
image?: string;
author?: string;
tags?: string[];
updated?: number;
}[];
}`,
},
}
func TestTsGen(t *testing.T) {
for _, c := range cases {
spec := &openapi3.Swagger{}
err := json.Unmarshal([]byte(c.openapi), &spec)
if err != nil {
t.Fatal(err)
}
//spew.Dump(spec.Components.Schemas)
res := schemaToTs(c.key, spec.Components.Schemas[c.key])
if res != c.tsresult {
t.Logf("Expected %v, got: %v", c.tsresult, res)
}
}
}

424
cmd/tsgen/main.go Normal file
View File

@@ -0,0 +1,424 @@
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"text/template"
"github.com/Masterminds/semver/v3"
"github.com/getkin/kin-openapi/openapi3"
"github.com/stoewer/go-strcase"
)
const (
postContentPath = "docs/hugo-tania/site/content/post"
docsURL = "services.m3o.com"
)
func main() {
files, err := ioutil.ReadDir(os.Args[1])
if err != nil {
log.Fatal(err)
}
workDir, _ := os.Getwd()
tsPath := filepath.Join(workDir, "clients", "ts")
for _, f := range files {
if f.IsDir() && !strings.HasPrefix(f.Name(), ".") {
serviceName := f.Name()
serviceDir := filepath.Join(workDir, f.Name())
serviceFiles, err := ioutil.ReadDir(serviceDir)
if err != nil {
fmt.Println("Failed to read service dir", err)
os.Exit(1)
}
skip := false
// detect openapi json file
apiJSON := ""
for _, serviceFile := range serviceFiles {
if strings.Contains(serviceFile.Name(), "api") && strings.HasSuffix(serviceFile.Name(), ".json") {
apiJSON = filepath.Join(serviceDir, serviceFile.Name())
}
if serviceFile.Name() == "skip" {
skip = true
}
}
if skip {
continue
}
fmt.Println(apiJSON)
fmt.Println("Processing folder", serviceDir)
// generate typescript files from openapi json
//gents := exec.Command("npx", "openapi-typescript", apiJSON, "--output", serviceName+".ts")
//gents.Dir = serviceDir
//fmt.Println(serviceDir)
//outp, err := gents.CombinedOutput()
//if err != nil {
// fmt.Println("Failed to make docs", string(outp))
// os.Exit(1)
//}
js, err := ioutil.ReadFile(apiJSON)
if err != nil {
fmt.Println("Failed to read json spec", err)
os.Exit(1)
}
spec := &openapi3.Swagger{}
err = json.Unmarshal(js, &spec)
if err != nil {
fmt.Println("Failed to unmarshal", err)
os.Exit(1)
}
tsContent := ""
typeNames := []string{}
for k, v := range spec.Components.Schemas {
tsContent += schemaToTs(k, v) + "\n\n"
typeNames = append(typeNames, k)
}
os.MkdirAll(filepath.Join(tsPath, serviceName), 0777)
f, err := os.OpenFile(filepath.Join(tsPath, serviceName, "index.ts"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
fmt.Println("Failed to open schema file", err)
os.Exit(1)
}
_, err = f.Write([]byte(tsContent))
if err != nil {
fmt.Println("Failed to append to schema file", err)
os.Exit(1)
}
f, err = os.OpenFile(filepath.Join(tsPath, "index.ts"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
fmt.Println("Failed to open index.ts", err)
os.Exit(1)
}
_, err = f.Write([]byte(""))
if err != nil {
fmt.Println("Failed to append to index file", err)
os.Exit(1)
}
}
}
// login to NPM
f, err := os.OpenFile(filepath.Join(tsPath, ".npmrc"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
fmt.Println("Failed to open npmrc", err)
os.Exit(1)
}
defer f.Close()
if len(os.Getenv("NPM_TOKEN")) == 0 {
fmt.Println("No NPM_TOKEN env found")
os.Exit(1)
}
if _, err = f.WriteString("\n//npm.pkg.github.com/:_authToken=" + os.Getenv("NPM_TOKEN")); err != nil {
fmt.Println("Failed to open npmrc", err)
os.Exit(1)
}
// get latest version from github
getVersions := exec.Command("npm", "show", "@micro/services", "time", "--json")
getVersions.Dir = tsPath
outp, err := getVersions.CombinedOutput()
if err != nil {
fmt.Println("Failed to get versions of NPM package", string(outp))
os.Exit(1)
}
versions := map[string]interface{}{}
err = json.Unmarshal(outp, &versions)
if err != nil {
fmt.Println("Failed to unmarshal versions", string(outp))
os.Exit(1)
}
var latest *semver.Version
for version, _ := range versions {
v, err := semver.NewVersion(version)
if err != nil {
fmt.Println("Failed to parse semver", err)
os.Exit(1)
}
if latest == nil {
latest = v
}
if v.GreaterThan(latest) {
latest = v
}
}
newV := latest.IncPatch()
// bump package to latest version
fmt.Println("Bumping to ", newV.String())
repl := exec.Command("sed", "-i", "-e", "s/1.0.1/"+newV.String()+"/g", "package.json")
repl.Dir = tsPath
outp, err = repl.CombinedOutput()
if err != nil {
fmt.Println("Failed to make docs", string(outp))
os.Exit(1)
}
}
type specType struct {
name string
tag string
includeReadme bool
filePostFix string
titlePostFix string
template string
}
var specTypes = []specType{
{
name: "default markdown",
tag: "Readme",
filePostFix: ".md",
template: defTempl,
includeReadme: true,
},
}
func saveFile(tsDir string, serviceName string, spec *openapi3.Swagger) error {
for _, v := range specTypes {
fmt.Println("Processing ", v.name)
contentFile := filepath.Join(tsDir, serviceName+".ts")
fi, err := os.OpenFile(contentFile, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0777)
if err != nil {
return err
}
tmpl, err := template.New("test").Funcs(template.FuncMap{
"toLower": func(s string) string {
return strings.ToLower(s)
},
"params": func(p openapi3.Parameters) string {
ls := ""
for _, v := range p {
//if v.Value.In == "body" {
bs, _ := v.MarshalJSON()
ls += string(bs) + ", "
//}
}
return ls
},
// @todo should take SpecRef here not RequestBodyRef
"schemaJSON": func(prepend int, ref string) string {
for k, v := range spec.Components.Schemas {
// ie. #/components/requestBodies/PostsSaveRequest contains
// SaveRequest, can't see any other way to correlate
if strings.HasSuffix(ref, k) {
bs, _ := json.MarshalIndent(schemaToMap(v, spec.Components.Schemas), "", strings.Repeat(" ", prepend)+" ")
// last line wont get prepended so we fix that here
parts := strings.Split(string(bs), "\n")
// skip if it's only 1 line, ie it's '{}'
if len(parts) <= 1 {
return string(bs)
}
parts[len(parts)-1] = parts[len(parts)-1]
return strings.Join(parts, "\n")
}
}
return "Schema related to " + ref + " not found"
},
"schemaDescription": func(ref string) string {
for k, v := range spec.Components.Schemas {
// ie. #/components/requestBodies/PostsSaveRequest contains
// SaveRequest, can't see any other way to correlate
if strings.HasSuffix(ref, k) {
return v.Value.Description
}
}
return "Schema related to " + ref + " not found"
},
// turn chat/Chat/History
// to Chat History
"titleize": func(s string) string {
parts := strings.Split(s, "/")
if len(parts) > 2 {
return strings.Join(parts[2:], " ")
}
return strings.Join(parts, " ")
},
"firstResponseRef": func(rs openapi3.Responses) string {
return rs.Get(200).Ref
},
}).Parse(v.template)
if err != nil {
panic(err)
}
err = tmpl.Execute(fi, spec)
if err != nil {
return err
}
}
return nil
}
func schemaToMap(spec *openapi3.SchemaRef, schemas map[string]*openapi3.SchemaRef) map[string]interface{} {
var recurse func(props map[string]*openapi3.SchemaRef) map[string]interface{}
recurse = func(props map[string]*openapi3.SchemaRef) map[string]interface{} {
ret := map[string]interface{}{}
for k, v := range props {
k = strcase.SnakeCase(k)
//v.Value.
if v.Value.Type == "object" {
// @todo identify what is a slice and what is not!
// currently the openapi converter messes this up
// see redoc html output
ret[k] = recurse(v.Value.Properties)
continue
}
if v.Value.Type == "array" {
// @todo identify what is a slice and what is not!
// currently the openapi converter messes this up
// see redoc html output
ret[k] = []interface{}{recurse(v.Value.Properties)}
continue
}
switch v.Value.Type {
case "string":
if len(v.Value.Description) > 0 {
ret[k] = strings.Replace(v.Value.Description, "\n", ".", -1)
} else {
ret[k] = v.Value.Type
}
case "number":
ret[k] = 1
case "boolean":
ret[k] = true
}
}
return ret
}
return recurse(spec.Value.Properties)
}
func schemaToTs(title string, spec *openapi3.SchemaRef) string {
var recurse func(props map[string]*openapi3.SchemaRef, level int) string
recurse = func(props map[string]*openapi3.SchemaRef, level int) string {
ret := ""
i := 0
for k, v := range props {
ret += strings.Repeat(" ", level)
k = strcase.SnakeCase(k)
//v.Value.
switch v.Value.Type {
case "object":
// @todo identify what is a slice and what is not!
// currently the openapi converter messes this up
// see redoc html output
ret += k + "?: {\n" + recurse(v.Value.Properties, level+1) + strings.Repeat(" ", level) + "};"
case "array":
if len(v.Value.Items.Value.Properties) == 0 {
ret += k + "?: " + v.Value.Items.Value.Type + "[];"
} else {
// @todo identify what is a slice and what is not!
// currently the openapi converter messes this up
// see redoc html output
ret += k + "?: {\n" + recurse(v.Value.Items.Value.Properties, level+1) + strings.Repeat(" ", level) + "}[];"
}
case "string":
ret += k + "?: " + "string;"
case "number":
ret += k + "?: " + "number;"
case "boolean":
ret += k + "?: " + "boolean;"
}
if i < len(props) {
ret += "\n"
}
i++
}
return ret
}
return "export interface " + title + " {\n" + recurse(spec.Value.Properties, 1) + "}"
}
const defTempl = `
import { components } from './{{ .Info.Title | toLower }}_schema';
export interface types extends components {};
`
// CopyFile copies a file from src to dst. If src and dst files exist, and are
// the same, then return success. Otherise, attempt to create a hard link
// between the two files. If that fail, copy the file contents from src to dst.
// from https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang
func CopyFile(src, dst string) (err error) {
sfi, err := os.Stat(src)
if err != nil {
return
}
if !sfi.Mode().IsRegular() {
// cannot copy non-regular files (e.g., directories,
// symlinks, devices, etc.)
return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String())
}
dfi, err := os.Stat(dst)
if err != nil {
if !os.IsNotExist(err) {
return
}
} else {
if !(dfi.Mode().IsRegular()) {
return fmt.Errorf("CopyFile: non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String())
}
if os.SameFile(sfi, dfi) {
return
}
}
if err = os.Link(src, dst); err == nil {
return
}
err = copyFileContents(src, dst)
return
}
// copyFileContents copies the contents of the file named src to the file named
// by dst. The file will be created if it does not already exist. If the
// destination file exists, all it's contents will be replaced by the contents
// of the source file.
func copyFileContents(src, dst string) (err error) {
in, err := os.Open(src)
if err != nil {
return
}
defer in.Close()
out, err := os.Create(dst)
if err != nil {
return
}
defer func() {
cerr := out.Close()
if err == nil {
err = cerr
}
}()
if _, err = io.Copy(out, in); err != nil {
return
}
err = out.Sync()
return
}

2
datastore/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
datastore

3
datastore/Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM alpine
ADD datastore /datastore
ENTRYPOINT [ "/datastore" ]

27
datastore/Makefile Normal file
View File

@@ -0,0 +1,27 @@
GOPATH:=$(shell go env GOPATH)
.PHONY: init
init:
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
go get github.com/micro/micro/v3/cmd/protoc-gen-micro
.PHONY: proto
proto:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/datastore.proto
.PHONY: docs
docs:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/datastore.proto
@redoc-cli bundle api-datastore.json
.PHONY: build
build:
go build -o datastore *.go
.PHONY: test
test:
go test -v ./... -cover
.PHONY: docker
docker:
docker build . -t datastore:latest

4
datastore/README.md Normal file
View File

@@ -0,0 +1,4 @@
# Datastore Service
The Datastore service is a document store with simple querying capabilities.
Tutorial coming soon.

2
datastore/generate.go Normal file
View File

@@ -0,0 +1,2 @@
package main
//go:generate make proto

View File

@@ -0,0 +1,140 @@
package handler
import (
"context"
"encoding/json"
"strings"
log "github.com/micro/micro/v3/service/logger"
"github.com/micro/micro/v3/service/model"
datastore "github.com/micro/services/datastore/proto"
)
var indexIndex = model.Index{
FieldName: "TypeOf",
}
type IndexRecord struct {
ID string
TypeOf string
Index model.Index
}
type Datastore struct {
}
func (e *Datastore) Create(ctx context.Context, req *datastore.CreateRequest, rsp *datastore.CreateResponse) error {
log.Info("Received Datastore.Create request")
m := map[string]interface{}{}
err := json.Unmarshal([]byte(req.Value), &m)
if err != nil {
return err
}
indexes, err := e.getIndexes(ctx)
if err != nil {
return err
}
db := model.New(map[string]interface{}{}, &model.Options{
Indexes: indexes,
})
return db.Context(ctx).Create(m)
}
func (e *Datastore) Update(ctx context.Context, req *datastore.UpdateRequest, rsp *datastore.UpdateResponse) error {
log.Info("Received Datastore.Update request")
m := map[string]interface{}{}
err := json.Unmarshal([]byte(req.Value), &m)
if err != nil {
return err
}
indexes, err := e.getIndexes(ctx)
if err != nil {
return err
}
db := model.New(map[string]interface{}{}, &model.Options{
Indexes: indexes,
})
return db.Context(ctx).Update(m)
}
func (e *Datastore) getIndexes(ctx context.Context) ([]model.Index, error) {
indexDb := model.New(map[string]interface{}{}, &model.Options{
Indexes: []model.Index{indexIndex},
})
result := []IndexRecord{}
err := indexDb.Context(ctx).Read(model.QueryEquals("TypeOf", "_index"), &result)
if err != nil {
return nil, err
}
indexes := []model.Index{}
for _, v := range result {
indexes = append(indexes, v.Index)
}
return indexes, nil
}
func (e *Datastore) Read(ctx context.Context, req *datastore.ReadRequest, rsp *datastore.ReadResponse) error {
log.Info("Received Datastore.Read request")
q := toQuery(req.Query)
result := []map[string]interface{}{}
indexes, err := e.getIndexes(ctx)
if err != nil {
return err
}
db := model.New(map[string]interface{}{}, &model.Options{
Indexes: indexes,
})
err = db.Context(ctx).Read(q, &result)
if err != nil {
return err
}
js, err := json.Marshal(result)
rsp.Value = string(js)
return err
}
func (e *Datastore) CreateIndex(ctx context.Context, req *datastore.CreateIndexRequest, rsp *datastore.CreateIndexResponse) error {
log.Info("Received Datastore.Index request")
index := toIndex(req.Index)
indexRecord := IndexRecord{
ID: index.FieldName + index.Type + index.Order.FieldName + string(index.Order.Type),
Index: index,
TypeOf: "_index",
}
db := model.New(IndexRecord{}, &model.Options{
Indexes: []model.Index{indexIndex},
})
return db.Context(ctx).Create(indexRecord)
}
func (e *Datastore) Delete(ctx context.Context, req *datastore.DeleteRequest, rsp *datastore.DeleteResponse) error {
log.Info("Received Datastore.Delete request")
q := toQuery(req.Query)
return model.New(map[string]interface{}{}, nil).Context(ctx).Delete(q)
}
func toQuery(pquery *datastore.Query) model.Query {
q := model.QueryEquals(pquery.Index.FieldName, pquery.Value)
if pquery.Order != nil {
q.Order.FieldName = pquery.Order.FieldName
q.Order.Type = model.OrderType(pquery.Order.OrderType.String())
}
return q
}
func toIndex(pindex *datastore.Index) model.Index {
i := model.Index{
FieldName: pindex.FieldName,
Type: pindex.Type,
Unique: pindex.Unique,
}
if pindex.Order != nil {
i.Order = model.Order{
FieldName: pindex.FieldName,
Type: model.OrderType(strings.ToLower(pindex.Order.OrderType.String())),
}
}
return i
}

25
datastore/main.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"github.com/micro/services/datastore/handler"
pb "github.com/micro/services/datastore/proto"
"github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger"
)
func main() {
// Create service
srv := service.New(
service.Name("datastore"),
service.Version("latest"),
)
// Register handler
pb.RegisterDatastoreHandler(srv.Server(), new(handler.Datastore))
// Run service
if err := srv.Run(); err != nil {
logger.Fatal(err)
}
}

1
datastore/micro.mu Normal file
View File

@@ -0,0 +1 @@
service datastore

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,161 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/datastore.proto
package datastore
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Datastore service
func NewDatastoreEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Datastore service
type DatastoreService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...client.CallOption) (*CreateIndexResponse, error)
}
type datastoreService struct {
c client.Client
name string
}
func NewDatastoreService(name string, c client.Client) DatastoreService {
return &datastoreService{
c: c,
name: name,
}
}
func (c *datastoreService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Datastore.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *datastoreService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Datastore.Update", in)
out := new(UpdateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *datastoreService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Datastore.Read", in)
out := new(ReadResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *datastoreService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Datastore.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *datastoreService) CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...client.CallOption) (*CreateIndexResponse, error) {
req := c.c.NewRequest(c.name, "Datastore.CreateIndex", in)
out := new(CreateIndexResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Datastore service
type DatastoreHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error
Update(context.Context, *UpdateRequest, *UpdateResponse) error
Read(context.Context, *ReadRequest, *ReadResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
CreateIndex(context.Context, *CreateIndexRequest, *CreateIndexResponse) error
}
func RegisterDatastoreHandler(s server.Server, hdlr DatastoreHandler, opts ...server.HandlerOption) error {
type datastore interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
CreateIndex(ctx context.Context, in *CreateIndexRequest, out *CreateIndexResponse) error
}
type Datastore struct {
datastore
}
h := &datastoreHandler{hdlr}
return s.Handle(s.NewHandler(&Datastore{h}, opts...))
}
type datastoreHandler struct {
DatastoreHandler
}
func (h *datastoreHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.DatastoreHandler.Create(ctx, in, out)
}
func (h *datastoreHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.DatastoreHandler.Update(ctx, in, out)
}
func (h *datastoreHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.DatastoreHandler.Read(ctx, in, out)
}
func (h *datastoreHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.DatastoreHandler.Delete(ctx, in, out)
}
func (h *datastoreHandler) CreateIndex(ctx context.Context, in *CreateIndexRequest, out *CreateIndexResponse) error {
return h.DatastoreHandler.CreateIndex(ctx, in, out)
}

View File

@@ -0,0 +1,113 @@
syntax = "proto3";
package datastore;
option go_package = "proto;datastore";
// These endpoints are experimental and will likely change,
// especially related to indexes.
service Datastore {
rpc Create(CreateRequest) returns (CreateResponse) {}
rpc Update(UpdateRequest) returns (UpdateResponse) {}
rpc Read(ReadRequest) returns (ReadResponse) {}
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse) {}
}
message Query {
Index index = 1;
Order order = 2;
string value = 3;
int64 offset = 4;
int64 limit = 5;
}
// Order is the order of the index
message Order {
// Field to order on
// eg. age
string fieldName = 1;
// Ordered or unordered keys. Ordered keys are padded.
// Default is true. This option only exists for strings, where ordering
// comes at the cost of having rather long padded keys.
enum OrderType {
option allow_alias = true;
UNORDERED = 0;
ASCENDING = 1;
DESCENDING = 2;
}
// Type of the ordering
// eg. ascending, descending, unordered
OrderType orderType = 2;
}
message Index {
// Field to index on.
// eg. email
string fieldName = 1;
// Type of index
// eg. eq
string type = 2;
Order order = 3;
// Do not allow duplicate values of this field in the index.
// Useful for emails, usernames, post slugs etc.
bool unique = 4;
// Strings for ordering will be padded to a fix length
// Not a useful property for Querying, please ignore this at query time.
// Number is in bytes, not string characters. Choose a sufficiently big one.
// Consider that each character might take 4 bytes given the
// internals of reverse ordering. So a good rule of thumbs is expected
// characters in a string X 4
int64 stringOrderPadLength = 5;
// True = base32 encode ordered strings for easier management
// or false = keep 4 bytes long runes that might dispaly weirdly
bool Base32Encode = 6;
string FloatFormat = 7;
float Float64Max = 8;
float Float32Max = 9;
}
message CreateRequest {
// JSON marshalled record to save
string value = 1;
}
message CreateResponse {
}
message UpdateRequest {
// JSON marshalled record to save
string value = 1;
}
message UpdateResponse {
}
message ReadRequest {
Query query = 1;
}
message ReadResponse {
// JSON marshalled record found
string value = 1;
}
message DeleteRequest {
Query query = 1;
}
message DeleteResponse {
}
message CreateIndexRequest {
Index index = 1;
}
message CreateIndexResponse {
}

File diff suppressed because it is too large Load Diff

4
go.mod
View File

@@ -3,14 +3,16 @@ module github.com/micro/services
go 1.14
require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/SlyMarbo/rss v1.0.1
github.com/davecgh/go-spew v1.1.1
github.com/getkin/kin-openapi v0.26.0
github.com/golang/protobuf v1.4.3
github.com/google/uuid v1.1.2
github.com/gosimple/slug v1.9.0
github.com/hailocab/go-geoindex v0.0.0-20160127134810-64631bfe9711
github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa
github.com/micro/micro/v3 v3.0.5-0.20210127154217-fef839257cb5
github.com/micro/micro/v3 v3.0.5-0.20210128123520-45956342a06b
github.com/miekg/dns v1.1.31 // indirect
github.com/stoewer/go-strcase v1.2.0
github.com/stretchr/testify v1.6.1

56
go.sum
View File

@@ -47,6 +47,9 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L
github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
@@ -82,18 +85,19 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bwmarrin/discordgo v0.19.0/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q=
github.com/bwmarrin/discordgo v0.20.1/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q=
github.com/caddyserver/certmagic v0.10.6 h1:sCya6FmfaN74oZE46kqfaFOVoROD/mF36rTQfjN7TZc=
github.com/caddyserver/certmagic v0.10.6/go.mod h1:Y8jcUBctgk/IhpAzlHKfimZNyXCkfGgRTC0orl8gROQ=
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU=
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY=
github.com/cloudflare/cloudflare-go v0.10.9 h1:d8KOgLpYiC+Xq3T4tuO+/goM+RZvuO+T4pojuv8giL8=
github.com/cloudflare/cloudflare-go v0.10.9/go.mod h1:5TrsWH+3f4NV6WjtS5QFp+DifH81rph40gU374Sh0dQ=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
@@ -130,11 +134,7 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
github.com/dnsimple/dnsimple-go v0.30.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.4.2-0.20190710153559-aa8249ae1b8b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
@@ -142,6 +142,7 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch/v5 v5.0.0 h1:dKTrUeykyQwKb/kx7Z+4ukDs6l+4L41HqG1XHnhX7WE=
github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
@@ -156,8 +157,7 @@ github.com/getkin/kin-openapi v0.26.0 h1:xKIW5Z5wAfutxGBH+rr9qu0Ywfb/E1bPWkYLKRY
github.com/getkin/kin-openapi v0.26.0/go.mod h1:WGRs2ZMM1Q8LR1QBEwUxC6RJEfaBcD0s+pcEVXFuAjw=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-acme/lego/v3 v3.1.0/go.mod h1:074uqt+JS6plx+c9Xaiz6+L+GBb+7itGtzfcDM2AhEE=
github.com/go-acme/lego/v3 v3.4.0 h1:deB9NkelA+TfjGHVw8J7iKl/rMtffcGMWSMmptvMv0A=
github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M=
github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
@@ -173,9 +173,11 @@ github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3yg
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.3 h1:ZOigqf7iBxkA4jdQ3am7ATzdlOFp9YzA6NmuvEEZc9g=
github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
@@ -248,8 +250,10 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m
github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
@@ -264,10 +268,10 @@ github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hailocab/go-geoindex v0.0.0-20160127134810-64631bfe9711 h1:Oi8hPOZX0gaM2sPVXse2bMpfOjP47a7O61YuB6Z4sGk=
github.com/hailocab/go-geoindex v0.0.0-20160127134810-64631bfe9711/go.mod h1:+v2qJ3UZe4q2GfgZO4od004F/cMgJbmPSs7dD/ZMUkY=
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
github.com/hashicorp/go-retryablehttp v0.6.4 h1:BbgctKO892xEyOXnGiaAwIoSq1QZ/SS4AhjoAh9DnfY=
github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
@@ -362,6 +366,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
github.com/kolo/xmlrpc v0.0.0-20190717152603-07c4ee3fd181/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -404,6 +409,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -417,18 +423,18 @@ github.com/micro/micro/v3 v3.0.0-beta.6.0.20201016094841-ca8ffd563b2b/go.mod h1:
github.com/micro/micro/v3 v3.0.4 h1:GupR5YoV0A7hn6C9taD49voZyTyVQT/ihqtGDg867c0=
github.com/micro/micro/v3 v3.0.5-0.20201219085254-c8ea24387d19 h1:EtYX0x8UgndRyr1NbxOhbYDublbLYolGxftMv5QlAoY=
github.com/micro/micro/v3 v3.0.5-0.20201219085254-c8ea24387d19/go.mod h1:dZa1KcK6Uh9ny7nhgHxOvoPiZR5cAnZefYT+EMmGwp4=
github.com/micro/micro/v3 v3.0.5-0.20210127104758-0b759ad942a4 h1:RsLuIC27lqUiloWPitvRbJjkBuVNAkUsNSj6vJiacJI=
github.com/micro/micro/v3 v3.0.5-0.20210127104758-0b759ad942a4/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210127114057-8b4be865b86a h1:2dOu2GU5PPy8BLpbkgXv9Fz31AHJPMRGpXsGEd29ZMw=
github.com/micro/micro/v3 v3.0.5-0.20210127114057-8b4be865b86a/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210127125609-3c95b22d9553 h1:Ucgp8KlMJeaGzOZOfDnZCxBd0xkoBf6v1Vtv7LByJP0=
github.com/micro/micro/v3 v3.0.5-0.20210127125609-3c95b22d9553/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210125165249-844800facc76 h1:6AWM3vET7Gesy0l4Ob0dD3uXzIw1nk37d64wHGZj0fA=
github.com/micro/micro/v3 v3.0.5-0.20210125165249-844800facc76/go.mod h1:gTRCjPnKF3ExZTVFMbTzo1+x3LmvHWPQUYsnKIK+ot4=
github.com/micro/micro/v3 v3.0.5-0.20210126155917-64e1f3cde41d h1:R6Q7I9SaX+z9FTRAq2WRmNnkpt47rJUf5D8Hdl6QYl8=
github.com/micro/micro/v3 v3.0.5-0.20210126155917-64e1f3cde41d/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210127143903-789ea1c27f67 h1:cw9gVgwpc0p2/MqRGDFO22JOpr01d4QJ8JL5ZeXk3T4=
github.com/micro/micro/v3 v3.0.5-0.20210127143903-789ea1c27f67/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210127152852-66be29f3436d h1:PHeuOP+6EhbGgsF0L8k3hzEutNkgUjDgMNa1+/H8NNs=
github.com/micro/micro/v3 v3.0.5-0.20210127152852-66be29f3436d/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210127154217-fef839257cb5 h1:H+GimIg9PEkWz9sIxMDDg6uVOx4PPyvMmp1Sz2RWJ9U=
github.com/micro/micro/v3 v3.0.5-0.20210127154217-fef839257cb5/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210128091711-6008b182bc48 h1:SYPqZl9d1amQTJdiPCdJkmUcpzw+qSKwkPLokeNhPvs=
github.com/micro/micro/v3 v3.0.5-0.20210128091711-6008b182bc48/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/micro/micro/v3 v3.0.5-0.20210128123520-45956342a06b h1:NQvH8HfmA01/HTWYiCGN4kfAaPYEksaRoYUfCZNic8U=
github.com/micro/micro/v3 v3.0.5-0.20210128123520-45956342a06b/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.22/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
@@ -466,6 +472,7 @@ github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2
github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw=
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.3/go.mod h1:YZeBtGzYYEsCHp2LST/u/0NDwGkRoBtmn1cIWCJiS6M=
github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8=
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -531,6 +538,7 @@ github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 h1:ofR1ZdrNSkiWcMsRrubK9tb2/SlZVWttAfqUjJi6QYc=
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
@@ -563,7 +571,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE=
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf h1:Z2X3Os7oRzpdJ75iPqWZc0HeJWFYNCvKsfpQwFpRNTA=
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0=
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7/go.mod h1:imsgLplxEC/etjIhdr3dNzV3JeT27LbVu5pYWm0JCBY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@@ -579,13 +587,14 @@ github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4=
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA=
github.com/xanzy/go-gitlab v0.35.1 h1:jJSgT0NxjCvrSZf7Gvn2NxxV9xAYkTjYrKW8XwWhrfY=
github.com/xanzy/go-gitlab v0.35.1/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mBAUkycX616GzgsuYUOCHA5+HSlXI=
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -943,6 +952,7 @@ gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiV
gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/square/go-jose.v2 v2.4.1 h1:H0TmLt7/KmzlrDOpa1F+zr0Tk90PbJYBfsVUmRLrf9Y=
gopkg.in/square/go-jose.v2 v2.4.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=

View File

@@ -9,6 +9,11 @@ init:
proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/invites.proto
.PHONY: docs
docs:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/invites.proto
@redoc-cli bundle api-protobuf.json
.PHONY: build
build:
go build -o invites *.go

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.13.0
// protoc-gen-go v1.25.0
// protoc v3.6.1
// source: proto/invites.proto
package invites

File diff suppressed because it is too large Load Diff

1465
streams/proto/streams.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,11 @@ init:
proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/threads.proto
.PHONY: docs
docs:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/threads.proto
@redoc-cli bundle api-protobuf.json
.PHONY: build
build:
go build -o threads *.go

View File

@@ -7,7 +7,12 @@ init:
go get github.com/micro/micro/v3/cmd/protoc-gen-micro
.PHONY: proto
proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/users.proto
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/users.proto
.PHONY: docs
docs:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/users.proto
@redoc-cli bundle api-protobuf.json
.PHONY: build
build:

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.13.0
// protoc-gen-go v1.25.0
// protoc v3.6.1
// source: proto/users.proto
package users