Skip to content

Instantly share code, notes, and snippets.

@brito
Created May 23, 2020 02:14
Show Gist options
  • Save brito/0b9bc483452be8ff9f17b36d3ccf59d3 to your computer and use it in GitHub Desktop.
Save brito/0b9bc483452be8ff9f17b36d3ccf59d3 to your computer and use it in GitHub Desktop.
Simple ASCII slider visualization of two quantities and their relative ratio
/*
Simple ASCII slider visualization of two quantities and their relative ratio
eg */ select * from _slider(3,5); /*
*/
create function _slider(_left int, _right int, _glyphs text[] = '{-,|,-}')
returns text as $$
select
repeat(_glyphs[1], _left)
|| _glyphs[2] ||
repeat(_glyphs[3], _right)
$$ language sql immutable;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment