postgres

package
v0.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package postgres contains the database implementation of users repository layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migration

func Migration() *migrate.MemoryMigrationSource

Migration of Users service.

func NewDuplicateErrors added in v0.18.4

func NewDuplicateErrors() errors.Mapper

func NewRepository

func NewRepository(db postgres.Database) users.Repository

func PageQuery

func PageQuery(pm users.Page) (string, error)

func ToUser

func ToUser(dbu DBUser) (users.User, error)

Types

type DBUser

type DBUser struct {
	ID              string           `db:"id"`
	Domain          string           `db:"domain_id"`
	Secret          string           `db:"secret"`
	Metadata        []byte           `db:"metadata,omitempty"`
	PrivateMetadata []byte           `db:"private_metadata,omitempty"`
	Tags            pgtype.TextArray `db:"tags,omitempty"` // Tags
	CreatedAt       time.Time        `db:"created_at,omitempty"`
	UpdatedAt       sql.NullTime     `db:"updated_at,omitempty"`
	UpdatedBy       *string          `db:"updated_by,omitempty"`
	Groups          []groups.Group   `db:"groups,omitempty"`
	Status          users.Status     `db:"status,omitempty"`
	Role            *users.Role      `db:"role,omitempty"`
	Username        sql.NullString   `db:"username, omitempty"`
	FirstName       sql.NullString   `db:"first_name, omitempty"`
	LastName        sql.NullString   `db:"last_name, omitempty"`
	ProfilePicture  sql.NullString   `db:"profile_picture, omitempty"`
	Email           string           `db:"email,omitempty"`
	VerifiedAt      sql.NullTime     `db:"verified_at,omitempty"`
	AuthProvider    sql.NullString   `db:"auth_provider,omitempty"`
	TotalCount      uint64           `db:"total_count"`
}

type DBUsersPage

type DBUsersPage struct {
	Total       uint64           `db:"total"`
	Limit       uint64           `db:"limit"`
	Offset      uint64           `db:"offset"`
	FirstName   string           `db:"first_name"`
	LastName    string           `db:"last_name"`
	Username    string           `db:"username"`
	Id          string           `db:"id"`
	Email       string           `db:"email"`
	Metadata    []byte           `db:"metadata"`
	Tags        pgtype.TextArray `db:"tags"`
	GroupID     string           `db:"group_id"`
	Role        users.Role       `db:"role"`
	Status      users.Status     `db:"status"`
	IDs         pq.StringArray   `db:"ids"`
	CreatedFrom time.Time        `db:"created_from"`
	CreatedTo   time.Time        `db:"created_to"`
}

func ToDBUsersPage

func ToDBUsersPage(pm users.Page) (DBUsersPage, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL