-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ambarltd/sqlserver
Add sqlserver module
- Loading branch information
Showing
27 changed files
with
654 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: ambar-sqlserver | ||
on: | ||
push: | ||
paths: | ||
- 'ambar-sqlserver/**' | ||
|
||
# only one build per branch | ||
concurrency: | ||
group: build-sqlserver-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
ghc: ['9.10.1'] | ||
cabal: ['3.10.3.0'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup - GHC ${{ matrix.ghc }} | ||
uses: haskell-actions/setup@v2 | ||
id: setup | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
# Defaults, added for clarity: | ||
cabal-version: ${{ matrix.cabal }} | ||
cabal-update: true | ||
|
||
- name: Build - Configure | ||
run: | | ||
cd ambar-sqlserver | ||
cabal configure --enable-tests --enable-benchmarks | ||
cabal build all --dry-run | ||
# The last step generates dist-newstyle/cache/plan.json for the cache key. | ||
|
||
- name: Build - Restore cached dependencies | ||
uses: actions/cache/restore@v4 | ||
id: cache | ||
env: | ||
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | ||
with: | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | ||
restore-keys: ${{ env.key }}- | ||
|
||
- name: Build - Install dependencies | ||
# If we had an exact cache hit, the dependencies will be up to date. | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
cd ambar-sqlserver | ||
cabal build all --only-dependencies | ||
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. | ||
- name: Build - Save dependencies to cache | ||
uses: actions/cache/save@v4 | ||
# If we had an exact cache hit, trying to save the cache would error because of key clash. | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
|
||
- name: Build | ||
run: | | ||
cd ambar-sqlserver | ||
cabal build all | ||
- name: Test | ||
run: | | ||
cd ambar-sqlserver | ||
cabal run ambar-sqlserver-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Ambar utility modules | ||
|
||
This includes modules that are not application-specific and that are shared across application. | ||
|
||
- `ambar-hs-utils` - General-purpose utility modules | ||
- `ambar-sqlserver` - Convenient Microsoft SQL Server API wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ambar-hs-utils | ||
|
||
Functions used across Ambar's code. | ||
|
||
Each module could be a package of their own, but they are kept together here for simplicity of usage. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# ambar-sqlserver | ||
|
||
A wrapper around the [`mssql-simple`](https://hackage.haskell.org/package/mssql-simple) library to provide: | ||
- Applicative interfaces for field and row parsing. | ||
- Ability to provide explicit parsers for queries. | ||
- A strongly typed `Query` type with automatic transaction wrapping. | ||
- A `ToRow` class for standardised encoding of types in queries. | ||
|
||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
cabal-version: 3.4 | ||
name: ambar-sqlserver | ||
version: 0.1.0.0 | ||
license: NONE | ||
author: Ambar | ||
maintainer: [email protected] | ||
category: Database | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
|
||
common common | ||
ghc-options: -Wall | ||
default-extensions: | ||
DerivingStrategies | ||
LambdaCase | ||
OverloadedStrings | ||
RecordWildCards | ||
TypeFamilies | ||
TypeFamilyDependencies | ||
DeriveAnyClass | ||
|
||
library | ||
import: common | ||
exposed-modules: | ||
Database.SQLServer | ||
build-depends: | ||
base ^>=4.20.0.0 | ||
, ambar-hs-utils | ||
, bytestring | ||
, base16 | ||
, text | ||
, ms-tds | ||
, mssql-simple | ||
|
||
hs-source-dirs: src | ||
default-language: GHC2021 | ||
|
||
test-suite ambar-sqlserver-tests | ||
import: common | ||
default-language: GHC2021 | ||
type: exitcode-stdio-1.0 | ||
hs-source-dirs: test | ||
main-is: Main.hs | ||
build-depends: | ||
base ^>=4.20.0.0 | ||
, ambar-hs-utils | ||
, ambar-sqlserver | ||
, bytestring | ||
, text | ||
, hspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
with-compiler: ghc-9.10.1 | ||
packages: | ||
. | ||
../ambar-hs-utils |
Oops, something went wrong.