scanUser (postgres/user.go)

openilink-hub · internal/store/postgres/user.go · go · MIT
database, tag:embed-classified

PostgreSQL data access layer for user CRUD operations.

// Source: https://github.com/openilink/openilink-hub | License: MIT | Copyright 2026 The OpeniLink Authors
// Provided via justclaw.it.com; keep this notice with the code.
package postgres

import (
	"github.com/google/uuid"
	"github.com/openilink/openilink-hub/internal/store"
)

const userSelectCols = `id, username, email, display_name, password_hash, role, status,
	EXTRACT(EPOCH FROM created_at)::BIGINT, EXTRACT(EPOCH FROM updated_at)::BIGINT`

func scanUser(scanner interface{ Scan(...any) error }) (*store.User, error) {
	u := &store.User{}
	err := scanner.Scan(&u.ID, &u.Username, &u.Email, &u.DisplayName,
		&u.PasswordHash, &u.Role, &u.Status, &u.CreatedAt, &u.UpdatedAt)
	if err != nil {
		return nil, err
	}
	return u, nil
}

func (db *DB) CreateUser(username, displayName string) (*sto

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key