base
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/vendor/
|
||||
/seven-skies
|
||||
/.vscode/launch.json
|
||||
8
.golangci.yaml
Normal file
8
.golangci.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
version: "2"
|
||||
linters:
|
||||
default: all
|
||||
disable:
|
||||
- revive
|
||||
- depguard
|
||||
- tagliatelle
|
||||
- wsl # deprecated
|
||||
14
.pre-commit-config.yaml
Normal file
14
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
name: golangci-lint
|
||||
entry: make lint
|
||||
language: system
|
||||
types: [go]
|
||||
|
||||
- id: test
|
||||
name: test
|
||||
entry: make test
|
||||
language: system
|
||||
types: [go]
|
||||
36
Makefile
Normal file
36
Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
.PHONY: build
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux go build -o . ./cmd/...
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
CGO_ENABLED=0 GOOS=linux go install ./cmd/...
|
||||
|
||||
.PHONY: update
|
||||
update:
|
||||
go get -u -t ./...
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
# go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.2
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: fix
|
||||
fix:
|
||||
# go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.2
|
||||
golangci-lint run --fix
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -race -shuffle=on ./...
|
||||
|
||||
.PHONY: validate
|
||||
validate: fix test
|
||||
|
||||
.PHONY: cover
|
||||
cover:
|
||||
go test ./... --coverpkg ./... -coverprofile=c.out
|
||||
go tool cover -html="c.out"
|
||||
rm c.out
|
||||
9
api/.gitignore
vendored
Normal file
9
api/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# MacOS
|
||||
.DS_Store
|
||||
|
||||
# Default TypeSpec output
|
||||
tsp-output/
|
||||
dist/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
44
api/main.tsp
Normal file
44
api/main.tsp
Normal file
@@ -0,0 +1,44 @@
|
||||
import "@typespec/http";
|
||||
|
||||
using Http;
|
||||
@service(#{ title: "Widget Service" })
|
||||
namespace DemoService;
|
||||
|
||||
model Widget {
|
||||
id: string;
|
||||
weight: int32;
|
||||
color: "red" | "blue";
|
||||
}
|
||||
|
||||
model WidgetList {
|
||||
items: Widget[];
|
||||
}
|
||||
|
||||
@error
|
||||
model Error {
|
||||
code: int32;
|
||||
message: string;
|
||||
}
|
||||
|
||||
model AnalyzeResult {
|
||||
id: string;
|
||||
analysis: string;
|
||||
}
|
||||
|
||||
@route("/widgets")
|
||||
@tag("Widgets")
|
||||
interface Widgets {
|
||||
/** List widgets */
|
||||
@get list(): WidgetList | Error;
|
||||
/** Read widgets */
|
||||
@get read(@path id: string): Widget | Error;
|
||||
/** Create a widget */
|
||||
@post create(@body body: Widget): Widget | Error;
|
||||
/** Update a widget */
|
||||
@patch update(@path id: string, @body body: MergePatchUpdate<Widget>): Widget | Error;
|
||||
/** Delete a widget */
|
||||
@delete delete(@path id: string): void | Error;
|
||||
|
||||
/** Analyze a widget */
|
||||
@route("{id}/analyze") @post analyze(@path id: string): AnalyzeResult | Error;
|
||||
}
|
||||
13
api/package.json
Normal file
13
api/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "api",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@typespec/compiler": "latest",
|
||||
"@typespec/http": "latest",
|
||||
"@typespec/rest": "latest",
|
||||
"@typespec/openapi": "latest",
|
||||
"@typespec/openapi3": "latest"
|
||||
}
|
||||
}
|
||||
1051
api/pnpm-lock.yaml
generated
Normal file
1051
api/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
api/tspconfig.yaml
Normal file
7
api/tspconfig.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
emit:
|
||||
- "@typespec/openapi3"
|
||||
options:
|
||||
"@typespec/openapi3":
|
||||
emitter-output-dir: "{output-dir}/schema"
|
||||
openapi-versions:
|
||||
- 3.1.0
|
||||
19
cmd/seven-skies/main.go
Normal file
19
cmd/seven-skies/main.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
func version() string {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
return info.Main.Version
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.Println("version", version())
|
||||
}
|
||||
7
internal/app/flow/service.go
Normal file
7
internal/app/flow/service.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package flow
|
||||
|
||||
type Service struct {}
|
||||
|
||||
func NewService() *Service {
|
||||
return &Service{}
|
||||
}
|
||||
Reference in New Issue
Block a user