Skip to content

Commit

Permalink
rdbms common types
Browse files Browse the repository at this point in the history
  • Loading branch information
justcoon committed Dec 30, 2024
1 parent 40df902 commit 9aa51de
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 60 deletions.
19 changes: 1 addition & 18 deletions wit/deps/rdbms/mysql.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wasi:rdbms@0.0.1;

interface mysql {
use types.{date, time, timestamp};

variant error {
connection-failure(string),
Expand All @@ -10,24 +11,6 @@ interface mysql {
other(string)
}

record date {
year: s32,
month: u8,
day: u8
}

record time {
hour: u8,
minute: u8,
second: u8,
nanosecond: u32
}

record timestamp {
date: date,
time: time
}

variant db-column-type {
boolean,
tinyint,
Expand Down
44 changes: 2 additions & 42 deletions wit/deps/rdbms/postgres.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wasi:rdbms@0.0.1;

interface postgres {
use types.{date, time, timetz, timestamp, timestamptz, uuid, ip-address, mac-address};

variant error {
connection-failure(string),
Expand All @@ -10,48 +11,6 @@ interface postgres {
other(string)
}

record uuid {
high-bits: u64,
low-bits: u64
}

variant ip-address {
ipv4(tuple<u8, u8, u8, u8>),
ipv6(tuple<u16, u16, u16, u16, u16, u16, u16, u16>),
}

record mac-address {
octets: tuple<u8, u8, u8, u8, u8, u8>
}

record date {
year: s32,
month: u8,
day: u8
}

record time {
hour: u8,
minute: u8,
second: u8,
nanosecond: u32
}

record timestamp {
date: date,
time: time
}

record timestamptz {
timestamp: timestamp,
offset: s32
}

record timetz {
time: time,
offset: s32
}

record interval {
months: s32,
days: s32,
Expand Down Expand Up @@ -81,6 +40,7 @@ interface postgres {
excluded(timestamp),
unbounded
}

variant tstzbound {
included(timestamptz),
excluded(timestamptz),
Expand Down
47 changes: 47 additions & 0 deletions wit/deps/rdbms/types.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package wasi:rdbms@0.0.1;

interface types {

record uuid {
high-bits: u64,
low-bits: u64
}

variant ip-address {
ipv4(tuple<u8, u8, u8, u8>),
ipv6(tuple<u16, u16, u16, u16, u16, u16, u16, u16>),
}

record mac-address {
octets: tuple<u8, u8, u8, u8, u8, u8>
}

record date {
year: s32,
month: u8,
day: u8
}

record time {
hour: u8,
minute: u8,
second: u8,
nanosecond: u32
}

record timestamp {
date: date,
time: time
}

record timestamptz {
timestamp: timestamp,
offset: s32
}

record timetz {
time: time,
offset: s32
}

}

0 comments on commit 9aa51de

Please sign in to comment.