code: func (u *User) Create(db *sqlx.DB, fidT FlexIDType, fid string) error {
  	// Create the password hash
  	hpw, err := bcrypt.GenerateFromPassword([]byte(u.Password), 10)
  	if err != nil {
  		return err
  	}
  	tx, err := db.Beginx()
  	if err != nil {
  		return err
  	}
  	q := `INSERT INTO users (name, email, password, locationid, admin)
  	      VALUES ($1, $2, $3, 0, $4)
  	      RETURNING id`
  	var uid uint64
  	err = tx.QueryRowx(q, u.Name, u.Email, hpw, u.Admin).Scan(&uid)
  	if err != nil && err.Error() ==
  		`pq: duplicate key value violates unique constraint "users_email_key"` {
  		_ = tx.Rollback()
  		return err
  	}
  	if uid == 0 {
  		_ = tx.Rollback()
  		return err
  	}
  	q = `INSERT INTO userflexids (userid, flexid, flexidtype)
  	     VALUES ($1, $2, $3)`
  	_, err = tx.Exec(q, uid, u.Email, 1)
  	if err != nil {
  		_ = tx.Rollback()
  		return err
  	}
  	_, err = tx.Exec(q, uid, fid, 2)
  	if err != nil {
  		_ = tx.Rollback()
  		return err
  	}
  	if err = tx.Commit(); err != nil {
  		return err
  	}
  	u.ID = uid
  	return nil
  }
docs: // Create a new user in the database.