Compare commits
4 Commits
77a1f3b11d
...
0ee814abbe
Author | SHA1 | Date |
---|---|---|
xdrm-brackets | 0ee814abbe | |
Adrien Marquès | 36991ea9ef | |
Adrien Marquès | b3ef7de624 | |
Adrien Marquès | 822ef823e9 |
11
.drone.yml
11
.drone.yml
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: test
|
|
||||||
image: golang:1.13
|
|
||||||
commands:
|
|
||||||
- go get ./...
|
|
||||||
- go test -v -race -cover -coverprofile ./coverage.out ./...
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.16
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build -v ./...
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test -race -v ./... -cover
|
20
README.md
20
README.md
|
@ -1,6 +1,6 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://git.xdrm.io/go/aicra">
|
<a href="https://github.com/xdrm-io/aicra">
|
||||||
<img src="https://git.xdrm.io/go/aicra/raw/branch/0.4.0/readme.assets/logo.png" alt="aicra logo" width="200" height="200">
|
<img src="https://github.com/xdrm-io/aicra/raw/0.4.0/readme.assets/logo.png" alt="aicra logo" width="200" height="200">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -10,7 +10,11 @@
|
||||||
Fast, intuitive, and powerful configuration-driven engine for faster and easier <em>REST</em> development.
|
Fast, intuitive, and powerful configuration-driven engine for faster and easier <em>REST</em> development.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[![Go version](https://img.shields.io/badge/go_version-1.16-blue.svg)](https://golang.org/doc/go1.16) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Go Report Card](https://goreportcard.com/badge/git.xdrm.io/go/aicra)](https://goreportcard.com/report/git.xdrm.io/go/aicra) [![Go doc](https://godoc.org/git.xdrm.io/go/aicra?status.svg)](https://godoc.org/git.xdrm.io/go/aicra) [![Build Status](https://drone.xdrm.io/api/badges/go/aicra/status.svg)](https://drone.xdrm.io/go/aicra)
|
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
||||||
|
[![Go version](https://img.shields.io/badge/go_version-1.16-blue.svg)](https://golang.org/doc/go1.16)
|
||||||
|
[![Go doc](https://pkg.go.dev/badge/github.com/xdrm-io/aicra)](https://pkg.go.dev/github.com/xdrm-io/aicra)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/xdrm-io/aicra)](https://goreportcard.com/report/github.com/xdrm-io/aicra)
|
||||||
|
[![Build status](https://github.com/xdrm-io/aicra/actions/workflows/go.yml/badge.svg)](https://github.com/xdrm-io/aicra/actions/workflows/go.yml)
|
||||||
|
|
||||||
## Presentation
|
## Presentation
|
||||||
|
|
||||||
|
@ -43,11 +47,11 @@ To install the aicra package, you need to install Go and set your Go workspace f
|
||||||
|
|
||||||
1. you can use the below Go command to install aicra.
|
1. you can use the below Go command to install aicra.
|
||||||
```bash
|
```bash
|
||||||
$ go get -u git.xdrm.io/go/aicra
|
$ go get -u github.com/xdrm-io/aicra
|
||||||
```
|
```
|
||||||
2. Import it in your code:
|
2. Import it in your code:
|
||||||
```go
|
```go
|
||||||
import "git.xdrm.io/go/aicra"
|
import "github.com/xdrm-io/aicra"
|
||||||
```
|
```
|
||||||
|
|
||||||
## What's automated
|
## What's automated
|
||||||
|
@ -83,9 +87,9 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra"
|
"github.com/xdrm-io/aicra"
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/internal/ctx"
|
"github.com/xdrm-io/aicra/internal/ctx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetRequest extracts the current request from a context.Context
|
// GetRequest extracts the current request from a context.Context
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
"git.xdrm.io/go/aicra/internal/config"
|
"github.com/xdrm-io/aicra/internal/config"
|
||||||
"git.xdrm.io/go/aicra/internal/dynfunc"
|
"github.com/xdrm-io/aicra/internal/dynfunc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder for an aicra server
|
// Builder for an aicra server
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addBuiltinTypes(b *Builder) error {
|
func addBuiltinTypes(b *Builder) error {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package builtin
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AnyDataType is what its name tells
|
// AnyDataType is what its name tells
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAny_AvailableTypes(t *testing.T) {
|
func TestAny_AvailableTypes(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package builtin
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BoolDataType is what its name tells
|
// BoolDataType is what its name tells
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBool_AvailableTypes(t *testing.T) {
|
func TestBool_AvailableTypes(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FloatDataType is what its name tells
|
// FloatDataType is what its name tells
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFloat64_AvailableTypes(t *testing.T) {
|
func TestFloat64_AvailableTypes(t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IntDataType is what its name tells
|
// IntDataType is what its name tells
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInt_AvailableTypes(t *testing.T) {
|
func TestInt_AvailableTypes(t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fixedLengthRegex = regexp.MustCompile(`^string\((\d+)\)$`)
|
var fixedLengthRegex = regexp.MustCompile(`^string\((\d+)\)$`)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestString_AvailableTypes(t *testing.T) {
|
func TestString_AvailableTypes(t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UintDataType is what its name tells
|
// UintDataType is what its name tells
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUint_AvailableTypes(t *testing.T) {
|
func TestUint_AvailableTypes(t *testing.T) {
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,3 +1,3 @@
|
||||||
module git.xdrm.io/go/aicra
|
module github.com/xdrm-io/aicra
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
"git.xdrm.io/go/aicra/internal/config"
|
"github.com/xdrm-io/aicra/internal/config"
|
||||||
"git.xdrm.io/go/aicra/internal/ctx"
|
"github.com/xdrm-io/aicra/internal/ctx"
|
||||||
"git.xdrm.io/go/aicra/internal/reqdata"
|
"github.com/xdrm-io/aicra/internal/reqdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handler wraps the builder to handle requests
|
// Handler wraps the builder to handle requests
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra"
|
"github.com/xdrm-io/aicra"
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addBuiltinTypes(b *aicra.Builder) error {
|
func addBuiltinTypes(b *aicra.Builder) error {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server definition
|
// Server definition
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype/builtin"
|
"github.com/xdrm-io/aicra/datatype/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLegalServiceName(t *testing.T) {
|
func TestLegalServiceName(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package config
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parameter represents a parameter definition (from api.json)
|
// Parameter represents a parameter definition (from api.json)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/datatype"
|
"github.com/xdrm-io/aicra/datatype"
|
||||||
)
|
)
|
||||||
|
|
||||||
var braceRegex = regexp.MustCompile(`^{([a-z_-]+)}$`)
|
var braceRegex = regexp.MustCompile(`^{([a-z_-]+)}$`)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
"git.xdrm.io/go/aicra/internal/config"
|
"github.com/xdrm-io/aicra/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handler represents a dynamic aicra service handler
|
// Handler represents a dynamic aicra service handler
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testsignature Signature
|
type testsignature Signature
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
"git.xdrm.io/go/aicra/internal/config"
|
"github.com/xdrm-io/aicra/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Signature represents input/output arguments for service from the aicra configuration
|
// Signature represents input/output arguments for service from the aicra configuration
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/api"
|
"github.com/xdrm-io/aicra/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInputCheck(t *testing.T) {
|
func TestInputCheck(t *testing.T) {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/internal/config"
|
"github.com/xdrm-io/aicra/internal/config"
|
||||||
"git.xdrm.io/go/aicra/internal/multipart"
|
"github.com/xdrm-io/aicra/internal/multipart"
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.xdrm.io/go/aicra/internal/config"
|
"github.com/xdrm-io/aicra/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getEmptyService() *config.Service {
|
func getEmptyService() *config.Service {
|
||||||
|
|
Loading…
Reference in New Issue