Mairzzcllo/moonbit_sqlc_plugin/plugin does not have a README file
pub struct AdaptColumn {
name : String
not_null : Bool
is_array : Bool
ty : AdaptIdentifier
length : Int
comment : String
table : AdaptIdentifier
}pub struct AdaptIdentifier {
catalog : String
schema : String
name : String
}pub struct AdaptQuery {
text : String
name : String
cmd : QueryCmd
columns : Array[AdaptColumn]
params : Array[AdaptParameter]
comments : Array[String]
filename : String
}pub struct AdaptRequest {
settings : AdaptSettings
catalog : AdaptCatalog
queries : Array[AdaptQuery]
sqlc_version : String
}pub struct AdaptSchema {
name : String
comment : String
tables : Array[AdaptTable]
enums : Array[AdaptEnum]
}pub struct AdaptSettings {
version : String
engine : String
}pub struct AdaptTable {
name : String
schema : String
columns : Array[AdaptColumn]
comment : String
}pub struct Codegen {
out : String
plugin : String
options : Bytes
env : Array[String]
process : CodegenProcess?
wasm : CodegenWASM?
}pub struct Column {
name : String
not_null : Bool
is_array : Bool
comment : String
length : Int
is_named_param : Bool
is_func_call : Bool
scope : String
table : Identifier
table_alias : String
ty : Identifier
is_sqlc_slice : Bool
embed_table : Identifier
original_name : String
unsigned : Bool
array_dims : Int
}pub struct ColumnOverride {
table : String
column : String
moonbit_type : String
}type Emitterpub enum Expr {
Block(Array[Expr])
Ident(String)
Call(String, Array[Expr])
Let(String, Expr)
StrLit(String)
IntLit(Int)
ArrLit(Array[Expr])
Index(Expr, Expr)
Lambda(Array[ParamDef], Expr)
BinOp(String, Expr, Expr)
If(Expr, Expr, Expr)
Return(Expr)
Match(Expr, Array[(String, Expr)])
ForLoop(String, Expr, Array[Expr])
Unit
}pub struct FieldDef {
name : String
col_name : String
ty : TypeExpr
doc : String?
json_tag : String?
db_tag : String?
}pub struct File {
name : String
contents : Bytes
}pub struct InternalField {
name : String
ty : InternalType
not_null : Bool
comment : String
rename_to : String?
}pub struct InternalQuery {
name : String
text : String
cmd : QueryCardinality
raw_cmd : QueryCmd
params : Array[InternalParameter]
result_shape : InternalResultShape
comments : Array[String]
filename : String
}pub enum MessageOutcome {
Ok(Bytes)
Err(String)
}pub struct PluginOptions {
package_name : String
overrides : Array[(String, String)]
emit_json_tags : Bool
emit_db_tags : Bool
renames : Array[(String, String)]
emit_sql_as_comment : Bool
omit_unused_structs : Bool
emit_empty_slices : Bool
initialisms : String
json_tags_case_style : String
emit_exact_table_names : Bool
emit_methods_with_db_argument : Bool
column_overrides : Array[ColumnOverride]
nullable_overrides : Array[String]
strict_types : Bool
runtime_alias : String
}pub enum QueryCardinality {
OneRow
ManyRows
ExecResult
ExecCount
}pub enum QueryCmd {
One
Many
Exec
ExecRows
CopyFrom
Batch
ExecLastId
}pub enum TopLevel {
Struct(StructDef)
Enum(EnumDef)
Fn(FnDef)
TypeAlias(TypeAliasDef)
Import(ImportDef)
}fn apply_case_style(s : String, style : String) -> Stringfn capitalize_first(s : String) -> Stringfn default_runtime_alias() -> Stringfn emit_package_declaration(name : String) -> Stringfn escape_keyword(name : String) -> Stringfn generate_struct_from_fields(type_name : String, fields : Array[InternalField], doc : String?, is_pub : Bool, emit_json_tags : Bool, emit_db_tags : Bool, overrides : Array[(String, String)], nullable_overrides : Array[String], json_tags_case_style : String, _initialisms : Array[String]) -> StructDeffn generate_struct_from_table(table_name : String, columns : Array[AdaptColumn], comment : String, emit_json_tags : Bool, emit_db_tags : Bool, overrides : Array[(String, String)], column_overrides : Array[ColumnOverride], nullable_overrides : Array[String], renames : Array[(String, String)], emit_exact_table_names : Bool, json_tags_case_style : String, initialisms : Array[String], enum_renames : Array[(String, String)]) -> StructDeffn generate_types(catalog : AdaptCatalog, queries : Array[InternalQuery], adapt_queries : Array[AdaptQuery], emit_json_tags : Bool, emit_db_tags : Bool, overrides : Array[(String, String)], column_overrides : Array[ColumnOverride], nullable_overrides : Array[String], renames : Array[(String, String)], omit_unused_structs : Bool, emit_exact_table_names : Bool, json_tags_case_style : String, initialisms_str : String) -> Array[TopLevel]fn generate_types_from_catalog(catalog : AdaptCatalog, emit_json_tags : Bool, emit_db_tags : Bool, overrides : Array[(String, String)], column_overrides : Array[ColumnOverride], nullable_overrides : Array[String], renames : Array[(String, String)], omit_unused_structs : Bool, referenced_tables : Array[String], emit_exact_table_names : Bool, json_tags_case_style : String, initialisms : Array[String]) -> Array[TopLevel]fn lowercase_first(s : String) -> Stringfn map_internal_type(ir_type : InternalType, overrides : Array[(String, String)], enum_renames : Array[(String, String)]) -> TypeExprfn map_internal_type_nullable(ir_type : InternalType, not_null : Bool, overrides : Array[(String, String)], nullable_overrides : Array[String], enum_renames : Array[(String, String)]) -> TypeExprfn map_pg_to_value_constructor_str(name : String) -> Stringfn process_message(data : Bytes) -> Bytesfn qual_runtime_name(name : String) -> Stringfn set_runtime_alias(runtime_alias : String) -> Unitfn singularize_table_name(name : String) -> String| Input | Output | Reason |
|---|---|---|
| "user__name" | "UserName" | Double underscore → empty split segment, silently dropped |
| "_user" | "User" | Leading underscore → empty first segment, dropped |
| "user_name_" | "UserName" | Trailing underscore → empty last segment, dropped |
| "USER_NAME" | "USERNAME" | All-caps input stays uppercase (capitalize_first is no-op on uppercase) |
| "userName" | "UserName" | No underscore → only first letter capitalized |
| "user_name" | "UserName" | Same output as "UserName" — collision risk |
| "_" | "" | Single underscore → two empty segments → empty string |
| "" | "UnnamedType" | Empty input returns sentinel "UnnamedType" |
fn table_struct_base_name(table_name : String, emit_exact_table_names : Bool) -> Stringfn table_struct_type_name(table_name : String, emit_exact_table_names : Bool, initialisms : Array[String]) -> Stringfn unqual_runtime_name(name : String) -> Stringfn validate_codegen_type_names(catalog : AdaptCatalog, queries : Array[InternalQuery], adapt_queries : Array[AdaptQuery], omit_unused_structs : Bool, emit_exact_table_names : Bool, initialisms_str : String) -> Unit raisefn validate_strict_types(catalog : AdaptCatalog, queries : Array[AdaptQuery], overrides : Array[(String, String)], _strict_types : Bool) -> Unit raisefn value_ctor_to_from_fn(ctor : String) -> StringInstall
Download zipsqlc WASM plugin ? generate type-safe MoonBit database layer from SQL queries