go-sqlmock
go-sqlmock copied to clipboard
How can I use go-sqlmock to test a create table with specific primary key?
trafficstars
I have a function to get the primary key columns from a table. How can I use go-sqlmock to create a test case for this function?
Thansk in advance!
`type Mvl2Json struct { sync.Mutex db *sql.DB schemaName string tableName string mvlName string logger *logrus.Logger primaryKey []string lobColunms []string currentSeq int64 // 当前处理到的sequence$$ }
// primaryKey, 查询对象的主键列 func (m *Mvl2Json) PrimaryKey() {
...
m.primaryKey = append(m.primaryKey, primaryKeyColunm)
}`