func (db *Database) UserExistsID(id int) (bool, error) {
	row := db.db.QueryRow(`
		SELECT id FROM melodious.accounts WHERE id=$1 LIMIT 1;
	`, id)
	var _id int  
	err := row.Scan(&_id)
	if err == sql.ErrNoRows {
		return false, nil
	} else if err != nil {
		return false, err
	}
	return true, nil
}
UserExistsID - checks if user with given id exists.
Always check if returned error is not-nil, as it returns false on errors
package main
import (
	"crypto/sha256"
	"database/sql"
	"encoding/json"
	"errors"
	"fmt"
	"time"
	"github.com/apex/log"
	"github.com/lib/pq"
)
type Database struct {
	mel *Melodious
	db  *sql.DB
}
func (db *Database) GetUsersList() ([]*User, error) {
	rows, err := db.db.Query(`
		SELECT id, username, owner FROM melodious.accounts WHERE banned=false;
	`)
	if err != nil {
		return []*User{}, err
	}
	users := []*User{}
	for rows.Next() {
		user := &User{}
		err := rows.Scan(&(user.ID), &(user.Username), &(user.Owner))
		if err != nil {
			return []*User{}, err
		}
		users = append(users, user)
	}
	return users, nil
}
func (db *Database) HasUsers() (bool, error) {
	row := db.db.QueryRow(`
		SELECT id FROM melodious.accounts LIMIT 1;
	`)
	var id int
	err := row.Scan(&id)
	if err == sql.ErrNoRows {
		return false, nil
	} else if err != nil {
		return false, err
	}
	return true, err
}
func (db *Database) RegisterUser(name string, passhash string, ip string) error {
	return db.RegisterUserOwner(name, passhash, false, ip)
}
func (db *Database) RegisterUserOwner(name string, passhash string, owner bool, ip string) error {
	sum := sha256.Sum256([]byte(passhash))
	sumstr := fmt.Sprintf("%x", sum[:32])
	_, err := db.db.Exec(`
		INSERT INTO melodious.accounts (username, passhash, owner) VALUES ($1, $2, $3);
	`, name, sumstr, owner)
	if err != nil {
		return err
	}
	return nil
}
func (db *Database) DeleteUser(name string) error {
	_, err := db.db.Exec(`
		DELETE FROM melodious.accounts WHERE username=$1;
	`, name)
	if err != nil {
		return err
	}
	return nil
}
func (db *Database) DeleteUserID(id int) error {
	_, err := db.db.Exec(`
		DELETE FROM melodious.accounts WHERE id=$1;
	`, id)
	if err != nil {
		return err
	}
	return nil
}
func (db *Database) GetUserID(name string) (int, error) {
	row := db.db.QueryRow(`
		SELECT id FROM melodious.accounts WHERE username=$1 LIMIT 1;
	`, name)
	var id int
	err := row.Scan(&id)
	if err == sql.ErrNoRows {
		return -1, errors.New("no such user")
	} else if err != nil {
		return -1, err
	}
	return 0, err
}
func (db *Database) UserExists(name string) (bool, error) {
	row := db.db.QueryRow(`
		SELECT id FROM melodious.accounts WHERE username=$1 LIMIT 1;
	`, name)
	var id int  
	err := row.Scan(&id)
	if err == sql.ErrNoRows {
		return false, nil
	} else if err != nil {
		return false, err
	}
	return true, nil
}