Skip to content

Types

Field Manual Section 4 - Payload Specs

Tank brings a full type arsenal to the field. The Entity derive macro identifies the type you're using by inspecting its final path segment (the "trailer"). For example, std::collections::VecDeque, collections::VecDeque, or simply VecDeque all resolve to the same list type.

Tank maps ordinary Rust types (numbers, strings, times, collections) to the closest column types each driver supports, falling back to generic representations when appropriate. Below is the standard mapping of Rust types to each driver's column type. :x: indicates no native support at this time. Collection types may be emulated in some drivers using generic JSON/text representations.

Column Types

RustDuckDBSQLitePostgresMySQL
boolBOOLEANINTEGERBOOLEANBOOLEAN
i8TINYINTINTEGERSMALLINTTINYINT
i16SMALLINTINTEGERSMALLINTSMALLINT
i32INTEGERINTEGERINTEGERINTEGER
i64BIGINTINTEGERBIGINTBIGINT
i128HUGEINTNUMERIC(38)NUMERIC(38)
u8UTINYINTINTEGERSMALLINTTINYINT UNSIGNED
u16USMALLINTINTEGERINTEGERSMALLINT UNSIGNED
u32UINTEGERINTEGERBIGINTINTEGER UNSIGNED
u64UBIGINTINTEGERNUMERIC(19)BIGINT UNSIGNED
u128UHUGEINTNUMERIC(38)NUMERIC(38) UNSIGNED
isizeBIGINT ⚠️INTEGERNUMERIC(38)BIGINT ⚠️
usizeUBIGINT ⚠️INTEGERNUMERIC(38)BIGINT UNSIGNED ⚠️
f32FLOATREALREALFLOAT
f64DOUBLEREALDOUBLEDOUBLE
rust_decimal::DecimalDECIMALREALNUMERICNUMERIC
tank::FixedDecimal<W, S>DECIMAL(W,S)REALNUMERIC(W,S)NUMERIC(W,S)
charCHAR(1)TEXTCHAR(1)CHAR(1)
StringTEXTTEXTTEXTTEXT
Box<[u8]>BLOBBLOBBYTEABLOB
time::DateDATETEXT ⚠️DATEDATE
time::TimeTIMETEXT ⚠️TIMETIME
time::PrimitiveDateTimeTIMESTAMPTEXT ⚠️TIMESTAMPDATETIME
time::OffsetDateTimeTIMESTAMPTZTEXT ⚠️TIMESTAMPTZTIMESTAMP
std::time::DurationINTERVALINTERVAL
time::DurationINTERVALINTERVAL
tank::IntervalINTERVALINTERVAL
uuid::UuidUUIDTEXTUUIDCHAR(36)
[T; N]T[N]T[N]JSON
Vec<T>T[]T[]JSON
VecDeque<T>T[]T[]JSON
LinkedList<T>T[]T[]JSON
HashMap<K, V>MAP(K,V)JSON
BTreeMap<K, V>MAP(K,V)JSON

WARNING

When a type falls back to a generic representation (e.g. TEXT or JSON), Tank encodes it predictably so equality / ordering comparisons (where meaningful) behave as expected. Advanced indexing or operator support may vary by driver.

The special size types maps to the corresponding 64 bits integer or 32 bits integer depending on the size.

Wrapper Types

Beyond the standard munitions listed above, Tank supports a range of wrapper types you can deploy directly in your entities. The resulting SQL type is inferred from the inner payload your wrapper carries into battle.

Supported wrappers:

  • tank::Passive<T>: Omit on update / allow default generation on insert.
  • Option<T>: Nullable column.
  • Box<T>
  • Cell<T>
  • RefCell<T>
  • RwLock<T>
  • Arc<T>
  • Rc<T>

With this arsenal, your entities hit every target, every time.