紧急:运行时错误:无效的内存地址或nil指针取消引用

I am using the sqlx library to fetch a user from the database and this worked before but for some reason it does not work now.

I get this error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x61d093]

goroutine 1 [running]:
github.com/jmoiron/sqlx.(*DB).QueryRowx(0x0, 0xc08200e7d0, 0x4c, 0xc082097df0, 0x1, 0x1, 0x4c)
        D:/Go/src/github.com/jmoiron/sqlx/sqlx.go:335 +0x23
mgtow.co/user.ByUnique(0x7f77c0, 0x5, 0x83d030, 0x11, 0x411ddd, 0x0, 0x0)
        D:/Go/src/mgtow.co/user/user_crud.go:21 +0x26b
main.main()
        D:/Go/src/mgtow.co/main/main.go:102 +0x66

I run this in the main() function to test the code:

_, err := user.ByUnique("email", "myemail@gmail.com")
if err != nil {
    log.Println(err)
}

in the user package I have that function:

func ByUnique(column, value string) (*User, error) {

    query := fmt.Sprintf(`
        SELECT *
        FROM user
        WHERE
            %s = ? AND
            deleted = 0
        LIMIT 1;
    `, column)

    user := &User{}
    err := sql.DB.QueryRowx(query, value).StructScan(user)
    if err != nil {
        return nil, err
    }
    return user, nil
}

In the sql package there is a pointer to the sqlx.DB variable and an Init() function I run in main:

var DB *sqlx.DB

var ErrNoRows = sql.ErrNoRows

    func Init() {

        dsn := fmt.Sprintf("%s:%s@%s(%s)/%s?charset=utf8",
            config.DbUser, config.DbPass, config.DbProtocol, config.DbAddress, config.DbName)

        var err error
        // DB, err = sql.Open("mysql", dsn)
        DB, err = sqlx.Open("mysql", dsn)
        if err != nil {
            log.Fatal(err)
        }

        if err = DB.Ping(); err != nil {
            log.Fatal(err)
        }
    }

What could be the problem?