zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.37k stars 3.97k forks source link

NewPmMenuModel函数如何传参 #4367

Closed tuye01 closed 2 months ago

tuye01 commented 2 months ago
//goctl代码生成 实例化结构体方法
func NewPmMenuModel(conn sqlx.SqlConn) PmMenuModel {
    return &customPmMenuModel{
        defaultPmMenuModel: newPmMenuModel(conn),
      }
 }

//全局db实例 如何转换为sqlx.SqlConn
var SqlDB *sqlx.DB
tuye01 commented 2 months ago

初始化了*sqlx.DB实例却与NewPmMenuModel函数不符,调用函数如何正确的传参

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The *sqlx.DB instance is initialized but it does not match the NewPmMenuModel function. How to correctly pass parameters when calling the function?