Skip to content

uint64 issues #60

Closed
Closed
@Drabuna

Description

@Drabuna

Hi, I'm trying to use this together with sqlx and have discovered a weird issue - when trying to insert uint64 value I get a:
error: sql: converting argument $1 type: driver ColumnConverter error converted uint64 to unsupported type uint64

The moment I remove sqldb-logger (by setting c.loggingEnabled = false), the issue goes away and everything works fine.

Here some details on how I init the connection:

import (
	"context"
	"database/sql"
	_ "github.com/go-sql-driver/mysql"
	"github.com/jmoiron/sqlx"
	sqldblogger "github.com/simukti/sqldb-logger"
)

func init(c *Config) {
    dsn := c.MysqlConnectionString()

    sqlDb, err := sql.Open("mysql", dsn)
    if err != nil {
        return err
    }
    if c.loggingEnabled {
        sqlDb = sqldblogger.OpenDriver(dsn, sqlDb.Driver(), logger, sqldblogger.WithMinimumLevel(c.logLevel))
    }

    db := sqlx.NewDb(sqlDb, "mysql")
}

And then later I would run something like:

func (s *Store) CreateAccount(context context.Context, accountId uint64, email string, username string) (bool, error) {
	query := "INSERT INTO accounts (id, email, username, status, created_at, updated_at) VALUES (?, ?, ?, ?, NOW(), NOW())"
	res, err := s.db.ExecContext(context, query, accountId, email, username, constants.AccountActive)
	if err != nil {
		return false, err
	}
    return true, nil
}

And the CreateAccount will return an error specified above.

Thoughts, ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions