Skip to content

Instantly share code, notes, and snippets.

@cultleader777
Created June 7, 2023 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cultleader777/3823ccef5c22b4b086c2468ab9e2e89c to your computer and use it in GitHub Desktop.
Save cultleader777/3823ccef5c22b4b086c2468ab9e2e89c to your computer and use it in GitHub Desktop.
Detached defaults in EdenDB
TABLE server {
hostname TEXT PRIMARY KEY,
tld REF tld DETACHED DEFAULT,
fqdn TEXT GENERATED AS { hostname .. "." .. tld },
}
TABLE tld {
domain TEXT PRIMARY KEY,
}
DEFAULTS {
// defines default for table 'server' and column 'tld'.
// you cannot define defaults for non existing tables
// and column must be marked as detached default
server.tld epl-infra.net,
}
// now we can define data with detached default
DATA STRUCT server {
hostname: server-a
}
DATA tld {
epl-infra.net;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment