Started to debug schema with multiple struct and some time keyword
Added NOW already and now debuging some stuff regarding filter and parsing file of one struct when it should be another Also moved query test into a seperated test file. And some fix and changed in docs
This commit is contained in:
+1
-4
@@ -2,12 +2,9 @@ pub const BUFFER_SIZE = 1024 * 10; // Used a bit everywhere. The size for the sc
|
||||
pub const MAX_FILE_SIZE = 1024 * 1024; // 1MB
|
||||
pub const CPU_CORE = 16;
|
||||
|
||||
// Testing
|
||||
pub const TEST_DATA_DIR = "data";
|
||||
|
||||
// Debug
|
||||
pub const PRINT_STATE = false;
|
||||
pub const DONT_SEND = true;
|
||||
pub const DONT_SEND = false;
|
||||
pub const DONT_SEND_ERROR = false;
|
||||
pub const RESET_LOG_AT_RESTART = false; // If true, will reset the log file at the start of the db, otherwise just keep adding to it
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ pub fn parseBool(value_str: []const u8) bool {
|
||||
}
|
||||
|
||||
pub fn parseDate(value_str: []const u8) DateTime {
|
||||
if (std.mem.eql(u8, value_str, "NOW")) return DateTime.now();
|
||||
|
||||
const year: u16 = std.fmt.parseInt(u16, value_str[0..4], 10) catch 0;
|
||||
const month: u16 = std.fmt.parseInt(u16, value_str[5..7], 10) catch 0;
|
||||
const day: u16 = std.fmt.parseInt(u16, value_str[8..10], 10) catch 0;
|
||||
@@ -74,6 +76,8 @@ pub fn parseArrayDateUnix(allocator: std.mem.Allocator, array_str: []const u8) !
|
||||
}
|
||||
|
||||
pub fn parseTime(value_str: []const u8) DateTime {
|
||||
if (std.mem.eql(u8, value_str, "NOW")) return DateTime.now();
|
||||
|
||||
const hours: u16 = std.fmt.parseInt(u16, value_str[0..2], 10) catch 0;
|
||||
const minutes: u16 = std.fmt.parseInt(u16, value_str[3..5], 10) catch 0;
|
||||
const seconds: u16 = if (value_str.len > 6) std.fmt.parseInt(u16, value_str[6..8], 10) catch 0 else 0;
|
||||
@@ -107,6 +111,8 @@ pub fn parseArrayTimeUnix(allocator: std.mem.Allocator, array_str: []const u8) !
|
||||
}
|
||||
|
||||
pub fn parseDatetime(value_str: []const u8) DateTime {
|
||||
if (std.mem.eql(u8, value_str, "NOW")) return DateTime.now();
|
||||
|
||||
const year: u16 = std.fmt.parseInt(u16, value_str[0..4], 10) catch 0;
|
||||
const month: u16 = std.fmt.parseInt(u16, value_str[5..7], 10) catch 0;
|
||||
const day: u16 = std.fmt.parseInt(u16, value_str[8..10], 10) catch 0;
|
||||
|
||||
Reference in New Issue
Block a user