toJson method

String? toJson()

Encode as the JSON shape expected by odbc_pool_create_with_options. Returns an empty string when no fields are set (caller may pass null FFI pointer instead, equivalent meaning).

Implementation

String? toJson() {
  final map = <String, Object?>{
    if (idleTimeout != null) 'idle_timeout_ms': idleTimeout!.inMilliseconds,
    if (maxLifetime != null) 'max_lifetime_ms': maxLifetime!.inMilliseconds,
    if (connectionTimeout != null)
      'connection_timeout_ms': connectionTimeout!.inMilliseconds,
  };
  if (map.isEmpty) return null;
  return jsonEncode(map);
}