postgres

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 15 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 NewRepository

func NewRepository(db postgres.Database) users.Repository

func PageQuery added in v0.15.0

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

func ToUser added in v0.15.0

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

Types

type DBUser added in v0.15.0

type DBUser struct {
	ID             string           `db:"id"`
	Domain         string           `db:"domain_id"`
	Secret         string           `db:"secret"`
	Metadata       []byte           `db:"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"`
}

type DBUsersPage added in v0.15.0

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"`
	Tag       string       `db:"tag"`
	GroupID   string       `db:"group_id"`
	Role      users.Role   `db:"role"`
	Status    users.Status `db:"status"`
}

func ToDBUsersPage added in v0.15.0

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