Skip to content

Instantly share code, notes, and snippets.

@konikvranik
konikvranik / plantuml.groovy
Created January 6, 2024 18:54
SchemaCrawler PlantUML script for more detailed output
import schemacrawler.schema.Catalog
import schemacrawler.schema.Schema
import schemacrawler.schema.Table
println("@startuml")
println('''
!theme plain
hide empty methods
!procedure $schema($name, $slug)
@sualeh
sualeh / README.md
Last active October 23, 2025 05:35
Create Nice-looking Schema Diagrams in PlantUML

Create Nice-looking Schema Diagrams in PlantUML

PlantUML is a descriptive language to generate a number of types of software diagrams, such as sequence, class, deployment and state diagrams, and many others. PlantUML does not generate very good-looking schema diagrams out of the box, but it supports themes and preprocessed macros. If you use themes and macros, you can not only use a simplified syntax, but also generate beautiful diagrams.

Here is an example of a PlantUML schema diagram, and we will build up the code to generate it.

Schema diagram

To start, describe your schemas, tables and columns using this syntax as an example.

<!-- Custom caching policy for on HTTP POST for Azure API Management:
1. Policy looks in the Request body - 'cacheKey' property which then used as cache key.
Expected values are: <null>, ALL or NOEXPIRED
Defaults to ALL in case <null>
2. Cache expiration set to 60 seconds/1 minute
!-->
<policies>
<inbound>
<base />
@jgould22
jgould22 / Dockerfile
Last active February 6, 2026 05:15
Postgres 18 - Alpine - pg_partman with pg_jobmon
FROM postgres:18-alpine
LABEL maintainer="Jordan Gould <jordangould@gmail.com>"
# Based on https://github.com/andreaswachowski/docker-postgres/blob/master/initdb.sh
# pg_jobmon 1.5.0
# They never cut a release for 1.5.0 (https://github.com/omniti-labs/pg_jobmon/commit/b9d49e6d4603f2670b3a2d512c31fc7cd5e9a334)
ENV PG_JOBMON_VERSION=b9d49e6d4603f2670b3a2d512c31fc7cd5e9a334
ENV PG_PARTMAN_VERSION=v5.3.1
# Install pg_jobmon
@jdh30
jdh30 / JsonParser.fs
Last active February 28, 2025 18:00
Simple JSON parser written in F# using active patterns
type Json =
| Null
| Bool of bool
| Number of float
| String of string
| Array of Json list
| Object of (string * Json) list
type Bracket = Open | Close
@evadne
evadne / gist:440558b18228ca657ef22b465793a0c3
Last active June 21, 2024 01:57
Using SchemaCrawler on PostgreSQL databases
let ParallelThrottledIgnore (startOnCallingThread:bool) (parallelism:int) (xs:seq<Async<_>>) = async {
let! ct = Async.CancellationToken
let sm = new SemaphoreSlim(parallelism)
let count = ref 1
let res = TaskCompletionSource<_>()
let tryWait () =
try sm.Wait () ; true
with _ -> false
let tryComplete () =
if Interlocked.Decrement count = 0 then
@bslatner
bslatner / ExampleCall.fs
Last active October 31, 2022 15:42
Code for making rest API requests in F# using the RestSharp library
// StartResult would be the type of the response. Must be marked with [<CLIMutable>]
let response =
restWithResponse<StartResult> (
POST >> toResource "stopwatch/{type}/{key}/start" >> atUrl config.Url
>> withUrlSegment "type" stopwatchType
>> withUrlSegment "key" key
>> withFormValue "owner" owner
>> withExpectedStatusOk
)
@yawaramin
yawaramin / sql.fs
Last active December 10, 2024 17:55
Type-safe SQL query using phantom types to model query parts as state transitions
(*
An incomplete implementation of a type-safe SQL query in F#.
The idea is that a query is built up clause by clause, by representing
each additional clause being added on to the query as a state transition
between different types of queries. We capture these different types as
phantom types to make sure that only valid transitions (query clause
additions) as defined by us can be carried out.
The final result is a 'total query' that can be converted to a string,