DATA-DOG / go-sqlmock

Sql mock driver for golang to test database interactions
Other
6.13k stars 407 forks source link

How can I use go-sqlmock to test a create table with specific primary key? #203

Closed ahdong2007 closed 4 months ago

ahdong2007 commented 5 years ago

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)

}`

diegommm commented 4 months ago

Hi @ahdong2007! Closing as there is not enough information to help you, unfortunately. If the problem persists, reopen and provide the following information:

Thank you!