db

package
v0.0.0-...-18d79af Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddTeamLeaderParams

type AddTeamLeaderParams struct {
	TeamID   uuid.UUID  `json:"team_id"`
	LeaderID *uuid.UUID `json:"leader_id"`
}

type AddTeamMemberParams

type AddTeamMemberParams struct {
	TeamID *uuid.UUID `json:"team_id"`
	UserID *uuid.UUID `json:"user_id"`
}

type CreateTeamParams

type CreateTeamParams struct {
	TeamID   uuid.UUID   `json:"team_id"`
	Title    string      `json:"title"`
	LeaderID *uuid.UUID  `json:"leader_id"`
	Descr    pgtype.Text `json:"descr"`
}

type CreateUserParams

type CreateUserParams struct {
	Email        string `json:"email"`
	Name         string `json:"name"`
	UserName     string `json:"user_name"`
	PasswordHash string `json:"password_hash"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type NullUserRole

type NullUserRole struct {
	UserRole UserRole `json:"user_role"`
	Valid    bool     `json:"valid"` // Valid is true if UserRole is not NULL
}

func (*NullUserRole) Scan

func (ns *NullUserRole) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullUserRole) Value

func (ns NullUserRole) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	AddTeamLeader(ctx context.Context, arg AddTeamLeaderParams) error
	AddTeamMember(ctx context.Context, arg AddTeamMemberParams) error
	CreateTeam(ctx context.Context, arg CreateTeamParams) (Team, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	GetUser(ctx context.Context, userID uuid.UUID) (User, error)
	GetUsers(ctx context.Context) ([]User, error)
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) AddTeamLeader

func (q *Queries) AddTeamLeader(ctx context.Context, arg AddTeamLeaderParams) error

func (*Queries) AddTeamMember

func (q *Queries) AddTeamMember(ctx context.Context, arg AddTeamMemberParams) error

func (*Queries) CreateTeam

func (q *Queries) CreateTeam(ctx context.Context, arg CreateTeamParams) (Team, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, userID uuid.UUID) (User, error)

func (*Queries) GetUsers

func (q *Queries) GetUsers(ctx context.Context) ([]User, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type SchemaMigration

type SchemaMigration struct {
	Version int64 `json:"version"`
	Dirty   bool  `json:"dirty"`
}

type Team

type Team struct {
	TeamID    uuid.UUID        `json:"team_id"`
	Title     string           `json:"title"`
	Descr     pgtype.Text      `json:"descr"`
	LeaderID  *uuid.UUID       `json:"leader_id"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
	UpdatedAt pgtype.Timestamp `json:"updated_at"`
}

type TeamMember

type TeamMember struct {
	UserID *uuid.UUID `json:"user_id"`
	TeamID *uuid.UUID `json:"team_id"`
	Role   UserRole   `json:"role"`
}

type User

type User struct {
	UserID       uuid.UUID        `json:"user_id"`
	Email        string           `json:"email"`
	PasswordHash string           `json:"password_hash"`
	UserName     string           `json:"user_name"`
	Name         string           `json:"name"`
	IsActive     pgtype.Bool      `json:"is_active"`
	CreatedAt    pgtype.Timestamp `json:"created_at"`
	UpdatedAt    pgtype.Timestamp `json:"updated_at"`
}

type UserRole

type UserRole string
const (
	UserRoleOwner  UserRole = "owner"
	UserRoleMember UserRole = "member"
)

func (*UserRole) Scan

func (e *UserRole) Scan(src interface{}) error

Jump to

Keyboard shortcuts

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