All Projects → fsprojects → Rezoom.SQL

fsprojects / Rezoom.SQL

Licence: MIT License
Statically typechecks a common SQL dialect and translates it to various RDBMS backends

Programming Languages

F#
602 projects

Projects that are alternatives of or similar to Rezoom.SQL

Tbls
tbls is a CI-Friendly tool for document a database, written in Go.
Stars: ✭ 940 (+47.1%)
Mutual labels:  sqlite, sqlserver
Kangaroo
SQL client and admin tool for popular databases
Stars: ✭ 127 (-80.13%)
Mutual labels:  sqlite, sqlserver
Admin
AutoQuery + Admin UI for ServiceStack Projects
Stars: ✭ 47 (-92.64%)
Mutual labels:  sqlite, sqlserver
Rezoom.sql
Statically typechecks a common SQL dialect and translates it to various RDBMS backends
Stars: ✭ 621 (-2.82%)
Mutual labels:  sqlite, sqlserver
Php Crud Api
Single file PHP script that adds a REST API to a SQL database
Stars: ✭ 2,904 (+354.46%)
Mutual labels:  sqlite, sqlserver
Zxw.framework.netcore
基于EF Core的Code First模式的DotNetCore快速开发框架,其中包括DBContext、IOC组件autofac和AspectCore.Injector、代码生成器(也支持DB First)、基于AspectCore的memcache和Redis缓存组件,以及基于ICanPay的支付库和一些日常用的方法和扩展,比如批量插入、更新、删除以及触发器支持,当然还有demo。欢迎提交各种建议、意见和pr~
Stars: ✭ 691 (+8.14%)
Mutual labels:  sqlite, sqlserver
Servicestack.ormlite
Fast, Simple, Typed ORM for .NET
Stars: ✭ 1,532 (+139.75%)
Mutual labels:  sqlite, sqlserver
Efcore.bulkextensions
Entity Framework Core Bulk Batch Extensions for Insert Update Delete Read (CRUD), Truncate and SaveChanges operations on SQL Server, PostgreSQL, SQLite
Stars: ✭ 2,295 (+259.15%)
Mutual labels:  sqlite, sqlserver
Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (-72.46%)
Mutual labels:  sqlite, sqlserver
Modernarchitectureshop
The Microservices Online Shop is an application with a modern software architecture that is cleanly designed and based on.NET lightweight technologies. The shop has two build variations. The first variant is the classic Microservices Architectural Style. The second one is with Dapr. Dapr has a comprehensive infrastructure for building highly decoupled Microservices; for this reason, I am using Dapr to achieve the noble goal of building a highly scalable application with clean architecture and clean code.
Stars: ✭ 154 (-75.9%)
Mutual labels:  sqlite, sqlserver
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+4056.34%)
Mutual labels:  sqlite, sqlserver
erdiagram
Entity-Relationship diagram code generator library
Stars: ✭ 28 (-95.62%)
Mutual labels:  sqlite, sqlserver
Evolve
Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
Stars: ✭ 477 (-25.35%)
Mutual labels:  sqlite, sqlserver
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+21.28%)
Mutual labels:  sqlite, sqlserver
Dibi
Dibi - smart database abstraction layer
Stars: ✭ 373 (-41.63%)
Mutual labels:  sqlite, sqlserver
Ebean
Ebean ORM
Stars: ✭ 1,172 (+83.41%)
Mutual labels:  sqlite, sqlserver
INTER-Mediator
The new style web application framework, you could develop a db-driven web application with declarative descriptions.
Stars: ✭ 27 (-95.77%)
Mutual labels:  sqlite, sqlserver
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+2743.19%)
Mutual labels:  sqlite, sqlserver
Dapper.linq
Dapper.Linq
Stars: ✭ 143 (-77.62%)
Mutual labels:  sqlite, sqlserver
Freesql
🦄 .NET orm, Mysql orm, Postgresql orm, SqlServer orm, Oracle orm, Sqlite orm, Firebird orm, 达梦 orm, 人大金仓 orm, 神通 orm, 翰高 orm, 南大通用 orm, Click house orm, MsAccess orm.
Stars: ✭ 3,077 (+381.53%)
Mutual labels:  sqlite, sqlserver

Build Status

Tutorial & full documentation

Query playground -- try out the SQL dialect live!

Statically typed SQL for F#

Rezoom.SQL is an F# ORM for SQL databases.

It integrates with the F# compiler via a generative type provider to statically typecheck its own dialect of SQL. It knows how to translate this SQL dialect to various backends. Currently it supports SQLite, SQL Server, and PostgreSQL.

The type provider makes it fast and easy to write SQL statements, run them, and consume their results from your F# code with full type safety. You don't need to install any editor extensions or custom tooling, just add a NuGet package and you're off and running writing code like this:

animated example usage to write queries

Database schema inferred from migration scripts

In order to typecheck your queries, Rezoom.SQL has to know your database schema (so it can know, for example, that the Id column in the Users table is an int). It learns the schema by reading your migration scripts and observing what tables and views are created, columns added, and so on.

When developing the first iteration of your application (or a new feature with its own migration script), it's easy to sketch out a model then go back and change it as you code, without having to touch a real database until you're ready to run.

Here's an example. You might want to refresh the page to start the GIF from the beginning.

animated example usage to write queries

Because this is a generative type provider, it makes plain old .NET types you can use from other languages. That is, you can write an F# project that uses Rezoom.SQL and defines your migrations and queries, then reference that from C# or VB.NET projects and use the generated query types with no problem in those langages. There is even an option to represent nullable types with C#-style System.Nullable<T> instead of FSharpOption<T> to make this scenario work extra smoothly.

Check out the query playground to see what kinds of SQL you can write.

The productivity of static typing

When you make schema changes -- for example, replacing FirstName and LastName fields with a single FullName field -- it's comforting to know the compiler will point out the queries you need to update.

The typechecker also tightens up the feedback loop, so you don't waste your time tracking down typos and trivial SQL mistakes you'd normally only encounter at runtime.

Here are just a handful of possible errors you'll be informed of at compile time and can fix in seconds. There are currently over 45 different error types that can be detected at compile time.

Mistyped table names

example error on mistyped table name

Incompatible data types

example error on comparing string to int

Selecting columns not included in a GROUP BY clause

example error on selecting column not found in group by clause

Flexible migration order for working in teams

Since Rezoom.SQL understands the language, it knows that some migrations like alter table X add column Y and alter table X add column Z can be run in any order and produce the same effects.

When you're working with a team, you can take advantage of this to add the tables and columns you need for the feature you're coding, while your other team members do the same for their features -- without having to decide the One True Migration Order when you merge.

See details here.

Integration with Rezoom

You can use Rezoom.SQL by itself, as in the example code above.

But as the name implies, it's designed to work with Rezoom. When you use it with Rezoom, you can take advantage of automatic caching and combine units of business logic to share round trips to the database.

Automatic batching

With Rezoom, you build up a Plan to represent a transaction, which may involve multiple SQL commands (or web API calls, or other high-latency data manipulation).

If you have one Plan called threeTrip that makes 3 queries, and another called twoTrip that makes 2 queries, you can choose whether to combine them sequentially for 5 round trips to the database...

let sequential =
    plan {
        let! x = threeTrip
        let! y = twoTrip
        return (x, y)
    }

sequential execution diagram

Or concurrently, for 3 round trips to the database. The first two query batches sent to the database will include pending queries from both threePlan and twoTrip:

let concurrent =
    plan {
        let! x, y = threeTrip, twoTrip
        return (x, y)
    }

sequential execution diagram

Automatic caching

Each statically typed query comes with some useful info for caching:

  • A compiler-generated ID
  • A boolean indicating whether it could make sense to cache (has no side effects, does not use rand(), newid(), etc)
  • A bitmask of the tables it reads from
  • A bitmask of the tables it writes to

Rezoom uses this cache info to avoid unnecessarily re-querying for the same data during the execution of a Plan (i.e. within a transaction).

This means if you have 30 different functions that call LoadUserPermissions(currentUserId), only 1 query for permissions will actually be run when you use those functions together in a transaction. Unless, of course, you edit the permissions table during the course of the transaction, in which case the cached result will automatically be invalidated and the permissions re-queried next time they are requested.

This lets you safely check all the invariants you need for each method in your domain layer, without fear of causing mountains of redundant queries, and without any of the effort of writing your own caching layer.

Get started

To get started using RZSQL, read the tutorial. It'll get you up and running in 5 minutes or your money back.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].