On Postgres 11 and later a nullable column with a default is a metadata-only change. Adding NOT NULL afterwards is the part that needs care.
Tag
Snippets tagged io
Returns one row per author with their posts nested, instead of a join that repeats the author on every row.
Iterating a file object yields one line at a time, which is the difference between a constant footprint and an OOM.
__post_init__ runs after the generated constructor, which is where cheap invariants belong.
`as const` keeps the literal types, so the derived union is the actual keys rather than string.
Ellipsis after two lines. The -webkit- prefixes are still required despite being supported everywhere.
One rule that disables animation for people who asked their system for less of it.
os.ReadFile replaced ioutil.ReadFile in 1.16 and is the one-liner for small files.
grep -o prints only the matching part, which turns grep into a crude extractor.
Matches a date, optionally with a time and a zone. Deliberately strict about separators.
Describes the shape of a payload so it can be validated before anything else touches it.
Verifies a download actually matches what the publisher signed, rather than trusting the transfer.