func (u UsersOp) GetUserID(username string) int64 {
	const query = "SELECT id FROM users WHERE username = $1"
	var id int64
	db, _ := ConnectDB()
	err := db.QueryRow(query, username).Scan(&id)
	if err != nil {
		log.Fatal(err)
	}
	return id
}
GetUserID Gets a user ID by username.
package data
import (
	"github.com/alfg/openencoder/api/types"
)
type Users interface {
	GetUsers(offset, count int) *[]types.User
	GetUserByID(id int) (*types.User, error)
	GetUsersCount() int
	GetUserByUsername(username string) (*types.User, error)
	GetUserID(username string) int64
	CreateUser(user types.User) (*types.User, error)
	UpdateUserByID(id int, user *types.User) (*types.User, error)
	UpdateUserPasswordByID(id int64, user *types.User) (*types.User, error)
}
type UsersOp struct {
	u *Users
}
var _ Users = &UsersOp{}
func (u UsersOp) GetUsers(offset, count int) *[]types.User {
	const query = `
	  SELECT *
	  FROM users 
	  ORDER BY id DESC
      LIMIT $1 OFFSET $2`
	db, _ := ConnectDB()
	users := []types.User{}
	err := db.Select(&users, query, count, offset)
	if err != nil {
		log.Fatal(err)
	}
	db.Close()
	return &users
}
func (u UsersOp) GetUserByID(id int) (*types.User, error) {
	const query = `
      SELECT *
      FROM users
      WHERE id = $1`
	db, _ := ConnectDB()
	user := types.User{}
	err := db.Get(&user, query, id)
	if err != nil {
		return &user, err
	}
	db.Close()
	return &user, nil
}
func (u UsersOp) GetUsersCount() int {
	var count int
	const query = `SELECT COUNT(*) FROM users`
	db, _ := ConnectDB()
	err := db.Get(&count, query)
	if err != nil {
		log.Fatal(err)
	}
	db.Close()
	return count
}
func (u UsersOp) GetUserByUsername(username string) (*types.User, error) {
	const query = `
      SELECT
        users.*
      FROM users
      WHERE users.username = $1`
	db, _ := ConnectDB()
	user := types.User{}
	err := db.Get(&user, query, username)
	if err != nil {
		log.Fatal(err)
		return &user, err
	}
	db.Close()
	return &user, nil
}