Giter Site home page Giter Site logo

table-spec's Introduction

table-spec

CircleCI Clojars Project

Specs (clojure.spec) from SQL database schema for data generation and validation.

Usage

> psql
postgres#= create table lol (id int not null, name varchar(250));
CREATE TABLE
...
:dependencies [[org.clojure/clojure "1.9.0-alpha14"]
               [viesti/table-spec "0.1.0"]
               [org.postgresql/postgresql "9.4.1212"]]
; For generating test data
:profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0" :scope "test"]]}}
...


user> (require '[table-spec.core :as t])
nil
user> (require '[clojure.spec :as s])
nil
user> (-> {:connection-uri "jdbc:postgresql:lol" :schema "public"}
          (t/tables)
          (t/register))
nil
user> (s/exercise :table/lol)
([#:lol{:id -1, :name ""} #:lol{:id -1, :name ""}] [#:lol{:id 0, :name "C"} #:lol{:id 0, :name "C"}]...
user> (s/exercise :lol/id)
([-1 -1] [-1 -1] [1 1] [0 0] [-1 -1] [0 0] [-2 -2] [-1 -1] [-1 -1] [-8 -8])

Changelog

0.1.1

  • Bump to Clojure 1.9.0
  • Support smallint, bigint, date, timestamp_with_timezone

0.1.0

  • Initial release

License

Copyright © 2019 Kimmo Koskinen

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.