database-js
database-js copied to clipboard
Add support to TXT files
Proposal
database-js-txt
Virtual Columns
Text files could have these virtual columns:
line(any line of the file)line_number
Examples:
# Line starting with Hello
SELECT `line_number`, `line` WHERE `line` LIKE "Hello%"
# First line in the file
SELECT `line` WHERE `line_number` = 1
# Number of lines in the file
SELECT COUNT( `line` )
# Number of lines in the file, different way
SELECT MAX( `line_number` )
# Last line in the file
SELECT `line` WHERE `line_number` = COUNT( `line` )
# Content from some lines
SELECT `line` WHERE `line_number` BETWEEN 5 AND 10
# Content from some lines, different way (needed?)
SELECT `line` OFFSET 5 LIMIT 5
Basic Operators
=, <>, >, >=, <, <=, LIKE, NOT, AND, OR, BETWEEN
Basic Constructions
WHERE, ORDER BY
Basic Functions
COUNT, MAX
Expected future enhancements
MATCHESoperator, for matching a given regular expression. E.g.,SELECT * WHERE line MATCHES "^Created at [0-9]{1,2}:[0-9]{1,2}"