go-sqlmock icon indicating copy to clipboard operation
go-sqlmock copied to clipboard

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

Open ahdong2007 opened this issue 6 years ago • 0 comments
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)

}`

ahdong2007 avatar Oct 23 '19 23:10 ahdong2007