The Data/Where/WherePri/And/Or methods support any string/map/slice/struct/*struct data type parameters, which provides gdb with great flexibility. When using struct/ *struct objects as input parameters, they will be automatically parsed as map types. Only the public attributes of the struct can be converted, and the orm/ gconv/ json tags are supported to define the key names after conversion, that is, the mapping relationship with the table fields.

    For example:

    1. type User struct {
    2. Uid int `orm:"user_id"`
    3. Name string `orm:"user_name"`
    4. NickName string `orm:"nick_name"`
    5. }
    6. // Or
    7. type User struct {
    8. Uid int `gconv:"user_id"`
    9. Name string `gconv:"user_name"`
    10. NickName string `gconv:"nick_name"`
    11. }
    12. // Or
    13. type User struct {
    14. Uid int `json:"user_id"`
    15. Name string `json:"user_name"`
    16. NickName string `json:"nick_name"`
    17. }

    In this, the attributes of struct should be public (first letter capitalized), and the orm tag corresponds to the field name of the data table. The tags for table field mapping relationships can use orm, gconv, or the traditional json tag. However, when all three tags are present, the orm tag takes precedence. To avoid conflicts with JSON encoding tags when converting struct objects to JSON data format, it is recommended to use the orm tag to achieve the database ORM mapping relationship. For more detailed conversion rules, please refer to the Type Conversion - Map section.