Skip to content

json and struct_tag_casing #602

@polderudo

Description

@polderudo

having:

tags:
  - json
relation_tag: "R"
no_back_referencing: true

struct_tag_casing: "snake"

the default db models are generated with correct json tag (snake-case):

The models(rows) for generated custom rows, however do not have any json tag set, like

-- SelEqpGetShelfSlots
with recursive cte as(
    select * from equip where equip.parent_eqp_id=$1
    union
    select e.* from equip e
                        join cte on e.parent_eqp_id=cte.eqp_id and e.eqp_type_id='HBWSlot'
) select cte.eqp_id, cte."name", cte.eqp_type_id, cte.parent_eqp_id,
         hs.pos1_hut as pos1_hut_id, hs.pos1_status, hs.pos1_status_reason,  hs.pos1_hut_status,
         hs.pos2_hut as pos2_hut_id, hs.pos2_status, hs.pos2_status_reason, hs.pos2_hut_status,
         hs.pos_x, hs.pos_y, hs.slot_size, hs.status, hs.status_reason, hs.slot_height, hs.count_free, hs.pos1_id,
         hs.pos2_id, hs.status_fixed, hs.reserved, hs.reserved_for, vh.has_content pos1_has_content, vh2.has_content pos2_has_content from cte
   join v_hbw_slot hs on hs.eqp_id =cte.eqp_id
   left outer join v_hut vh on hs.pos1_hut=vh.hut_id
   left outer join v_hut vh2 on hs.pos2_hut=vh2.hut_id
type SelEqpGetShelfSlotsRow = struct {
...
        Pos2StatusReason null.Val[string]          `db:"pos2_status_reason"`
	Pos2HutStatus    null.Val[enums.HutStatus] `db:"pos2_hut_status"`
	PosX             null.Val[int32]           `db:"pos_x"`
	PosY             null.Val[int32]           `db:"pos_y"`
...
}

Am I missing any configuration here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions