diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c42bb87 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + cache-dependency-path: go.mod + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: v2.12.2 + problem-matchers: true + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + cache-dependency-path: go.mod + + - name: Run unit tests + run: go test ./... diff --git a/engine/storage/jsonl/decoder.go b/engine/storage/jsonl/decoder.go index fb6c102..0cd118b 100644 --- a/engine/storage/jsonl/decoder.go +++ b/engine/storage/jsonl/decoder.go @@ -133,9 +133,9 @@ func (d *Decoder) decodeValue(name string, kind types.Kind, raw any) (types.Valu } case types.KindTimestamp: - return types.NewNullValue(), &types.TypeNotImplementedError{ - Field: name, - Kind: kind, + return types.NewNullValue(), &types.TypeError{ + Field: name, + Expected: kind, } default: diff --git a/engine/types/error.go b/engine/types/error.go index c9c5590..26f2ca1 100644 --- a/engine/types/error.go +++ b/engine/types/error.go @@ -14,13 +14,3 @@ func (e *TypeError) Error() string { return "type error: field " + e.Field + " expected " + string(e.Expected) + " but got " + string(e.Actual) } - -// TypeNotImplementedError represents an error that occurs when a value's type is not implemented in the system. -type TypeNotImplementedError struct { - Field string // The name of the field that caused the error - Kind Kind // The kind of the field that is not implemented -} - -func (e *TypeNotImplementedError) Error() string { - return "type not implemented error: field " + e.Field + " of kind " + string(e.Kind) + " is not implemented" -}