db

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLog

type AuditLog struct {
	ID            pgtype.UUID        `db:"id" json:"id"`
	ActorUserID   pgtype.UUID        `db:"actor_user_id" json:"actor_user_id"`
	ActorUsername string             `db:"actor_username" json:"actor_username"`
	Action        string             `db:"action" json:"action"`
	ResourceType  string             `db:"resource_type" json:"resource_type"`
	ResourceID    string             `db:"resource_id" json:"resource_id"`
	Metadata      []byte             `db:"metadata" json:"metadata"`
	CreatedAt     pgtype.Timestamptz `db:"created_at" json:"created_at"`
}

type AuthDeviceAuthorization

type AuthDeviceAuthorization struct {
	ID               pgtype.UUID        `db:"id" json:"id"`
	DeviceCode       string             `db:"device_code" json:"device_code"`
	UserCode         string             `db:"user_code" json:"user_code"`
	ClientName       string             `db:"client_name" json:"client_name"`
	RequestedScopes  []string           `db:"requested_scopes" json:"requested_scopes"`
	ApprovedByUserID pgtype.UUID        `db:"approved_by_user_id" json:"approved_by_user_id"`
	ApprovedAt       pgtype.Timestamptz `db:"approved_at" json:"approved_at"`
	LastPolledAt     pgtype.Timestamptz `db:"last_polled_at" json:"last_polled_at"`
	ExpiresAt        pgtype.Timestamptz `db:"expires_at" json:"expires_at"`
	Status           string             `db:"status" json:"status"`
	CreatedAt        pgtype.Timestamptz `db:"created_at" json:"created_at"`
	UpdatedAt        pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}

type AuthSession

type AuthSession struct {
	ID                   pgtype.UUID        `db:"id" json:"id"`
	UserID               pgtype.UUID        `db:"user_id" json:"user_id"`
	ClientName           string             `db:"client_name" json:"client_name"`
	UserAgent            string             `db:"user_agent" json:"user_agent"`
	RefreshTokenHash     string             `db:"refresh_token_hash" json:"refresh_token_hash"`
	RefreshTokenFamilyID pgtype.UUID        `db:"refresh_token_family_id" json:"refresh_token_family_id"`
	LastUsedAt           pgtype.Timestamptz `db:"last_used_at" json:"last_used_at"`
	ExpiresAt            pgtype.Timestamptz `db:"expires_at" json:"expires_at"`
	IdleExpiresAt        pgtype.Timestamptz `db:"idle_expires_at" json:"idle_expires_at"`
	RevokedAt            pgtype.Timestamptz `db:"revoked_at" json:"revoked_at"`
	RevokeReason         string             `db:"revoke_reason" json:"revoke_reason"`
	CreatedAt            pgtype.Timestamptz `db:"created_at" json:"created_at"`
	UpdatedAt            pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}

type CountActiveAuthSessionsByUserIDParams

type CountActiveAuthSessionsByUserIDParams struct {
	UserID pgtype.UUID `db:"user_id" json:"user_id"`
}

type CountAuditLogsParams

type CountAuditLogsParams struct {
	Action        interface{} `db:"action" json:"action"`
	ResourceType  interface{} `db:"resource_type" json:"resource_type"`
	ResourceID    interface{} `db:"resource_id" json:"resource_id"`
	ActorUsername interface{} `db:"actor_username" json:"actor_username"`
}

type CreateAuditLogParams

type CreateAuditLogParams struct {
	ActorUserID   pgtype.UUID `db:"actor_user_id" json:"actor_user_id"`
	ActorUsername string      `db:"actor_username" json:"actor_username"`
	Action        string      `db:"action" json:"action"`
	ResourceType  string      `db:"resource_type" json:"resource_type"`
	ResourceID    string      `db:"resource_id" json:"resource_id"`
	Metadata      []byte      `db:"metadata" json:"metadata"`
}

type CreateAuthDeviceAuthorizationParams

type CreateAuthDeviceAuthorizationParams struct {
	DeviceCode      string             `db:"device_code" json:"device_code"`
	UserCode        string             `db:"user_code" json:"user_code"`
	ClientName      string             `db:"client_name" json:"client_name"`
	RequestedScopes []string           `db:"requested_scopes" json:"requested_scopes"`
	ExpiresAt       pgtype.Timestamptz `db:"expires_at" json:"expires_at"`
	Status          string             `db:"status" json:"status"`
}

type CreateAuthSessionParams

type CreateAuthSessionParams struct {
	UserID               pgtype.UUID        `db:"user_id" json:"user_id"`
	ClientName           string             `db:"client_name" json:"client_name"`
	UserAgent            string             `db:"user_agent" json:"user_agent"`
	RefreshTokenHash     string             `db:"refresh_token_hash" json:"refresh_token_hash"`
	RefreshTokenFamilyID pgtype.UUID        `db:"refresh_token_family_id" json:"refresh_token_family_id"`
	LastUsedAt           pgtype.Timestamptz `db:"last_used_at" json:"last_used_at"`
	ExpiresAt            pgtype.Timestamptz `db:"expires_at" json:"expires_at"`
	IdleExpiresAt        pgtype.Timestamptz `db:"idle_expires_at" json:"idle_expires_at"`
}

type CreateNetworkDeviceParams

type CreateNetworkDeviceParams struct {
	MacAddress      string      `db:"mac_address" json:"mac_address"`
	DisplayName     string      `db:"display_name" json:"display_name"`
	Disabled        bool        `db:"disabled" json:"disabled"`
	VlanID          int32       `db:"vlan_id" json:"vlan_id"`
	CreatedByUserID pgtype.UUID `db:"created_by_user_id" json:"created_by_user_id"`
	UpdatedByUserID pgtype.UUID `db:"updated_by_user_id" json:"updated_by_user_id"`
}

type CreateVlanParams

type CreateVlanParams struct {
	VlanID      int32  `db:"vlan_id" json:"vlan_id"`
	Name        string `db:"name" json:"name"`
	Description string `db:"description" json:"description"`
}

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 DeleteNetworkDeviceParams

type DeleteNetworkDeviceParams struct {
	ID pgtype.UUID `db:"id" json:"id"`
}

type DeleteVlanParams

type DeleteVlanParams struct {
	VlanID int32 `db:"vlan_id" json:"vlan_id"`
}

type GetAuthDeviceAuthorizationByDeviceCodeParams

type GetAuthDeviceAuthorizationByDeviceCodeParams struct {
	DeviceCode string `db:"device_code" json:"device_code"`
}

type GetAuthDeviceAuthorizationByUserCodeParams

type GetAuthDeviceAuthorizationByUserCodeParams struct {
	UserCode string `db:"user_code" json:"user_code"`
}

type GetAuthSessionByIDParams

type GetAuthSessionByIDParams struct {
	ID pgtype.UUID `db:"id" json:"id"`
}

type GetAuthSessionByRefreshTokenHashParams

type GetAuthSessionByRefreshTokenHashParams struct {
	RefreshTokenHash string `db:"refresh_token_hash" json:"refresh_token_hash"`
}

type GetNetworkDeviceByIDParams

type GetNetworkDeviceByIDParams struct {
	ID pgtype.UUID `db:"id" json:"id"`
}

type GetNetworkDeviceByMACAddressParams

type GetNetworkDeviceByMACAddressParams struct {
	MacAddress string `db:"mac_address" json:"mac_address"`
}

type GetUserByIDParams

type GetUserByIDParams struct {
	ID pgtype.UUID `db:"id" json:"id"`
}

type GetUserByUsernameParams

type GetUserByUsernameParams struct {
	Username string `db:"username" json:"username"`
}

type GetVlanByNameParams

type GetVlanByNameParams struct {
	Name string `db:"name" json:"name"`
}

type GetVlanByVlanIDParams

type GetVlanByVlanIDParams struct {
	VlanID int32 `db:"vlan_id" json:"vlan_id"`
}

type ListActiveAuthSessionsByUserPageParams

type ListActiveAuthSessionsByUserPageParams struct {
	UserID      pgtype.UUID `db:"user_id" json:"user_id"`
	OffsetCount int32       `db:"offset_count" json:"offset_count"`
	LimitCount  int32       `db:"limit_count" json:"limit_count"`
}

type ListActiveAuthSessionsPageParams

type ListActiveAuthSessionsPageParams struct {
	OffsetCount int32 `db:"offset_count" json:"offset_count"`
	LimitCount  int32 `db:"limit_count" json:"limit_count"`
}

type ListAuditLogsParams

type ListAuditLogsParams struct {
	Action        interface{} `db:"action" json:"action"`
	ResourceType  interface{} `db:"resource_type" json:"resource_type"`
	ResourceID    interface{} `db:"resource_id" json:"resource_id"`
	ActorUsername interface{} `db:"actor_username" json:"actor_username"`
	OffsetCount   int32       `db:"offset_count" json:"offset_count"`
	LimitCount    int32       `db:"limit_count" json:"limit_count"`
}

type ListAuthSessionsByUserIDParams

type ListAuthSessionsByUserIDParams struct {
	UserID pgtype.UUID `db:"user_id" json:"user_id"`
}

type NetworkDevice

type NetworkDevice struct {
	ID              pgtype.UUID        `db:"id" json:"id"`
	MacAddress      string             `db:"mac_address" json:"mac_address"`
	DisplayName     string             `db:"display_name" json:"display_name"`
	VlanID          int32              `db:"vlan_id" json:"vlan_id"`
	CreatedByUserID pgtype.UUID        `db:"created_by_user_id" json:"created_by_user_id"`
	UpdatedByUserID pgtype.UUID        `db:"updated_by_user_id" json:"updated_by_user_id"`
	CreatedAt       pgtype.Timestamptz `db:"created_at" json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
	Disabled        bool               `db:"disabled" json:"disabled"`
}

type Querier

type Querier interface {
	CountActiveAuthSessions(ctx context.Context) (int64, error)
	CountActiveAuthSessionsByUserID(ctx context.Context, arg CountActiveAuthSessionsByUserIDParams) (int64, error)
	CountAuditLogs(ctx context.Context, arg CountAuditLogsParams) (int64, error)
	CountNetworkDevices(ctx context.Context) (int64, error)
	CountVlans(ctx context.Context) (int64, error)
	CreateAuditLog(ctx context.Context, arg CreateAuditLogParams) (AuditLog, error)
	CreateAuthDeviceAuthorization(ctx context.Context, arg CreateAuthDeviceAuthorizationParams) (AuthDeviceAuthorization, error)
	CreateAuthSession(ctx context.Context, arg CreateAuthSessionParams) (AuthSession, error)
	CreateNetworkDevice(ctx context.Context, arg CreateNetworkDeviceParams) (NetworkDevice, error)
	CreateVlan(ctx context.Context, arg CreateVlanParams) (Vlan, error)
	DeleteNetworkDevice(ctx context.Context, arg DeleteNetworkDeviceParams) error
	DeleteVlan(ctx context.Context, arg DeleteVlanParams) error
	GetAuthDeviceAuthorizationByDeviceCode(ctx context.Context, arg GetAuthDeviceAuthorizationByDeviceCodeParams) (AuthDeviceAuthorization, error)
	GetAuthDeviceAuthorizationByUserCode(ctx context.Context, arg GetAuthDeviceAuthorizationByUserCodeParams) (AuthDeviceAuthorization, error)
	GetAuthSessionByID(ctx context.Context, arg GetAuthSessionByIDParams) (AuthSession, error)
	GetAuthSessionByRefreshTokenHash(ctx context.Context, arg GetAuthSessionByRefreshTokenHashParams) (AuthSession, error)
	GetNetworkDeviceByID(ctx context.Context, arg GetNetworkDeviceByIDParams) (NetworkDevice, error)
	GetNetworkDeviceByMACAddress(ctx context.Context, arg GetNetworkDeviceByMACAddressParams) (NetworkDevice, error)
	GetUserByID(ctx context.Context, arg GetUserByIDParams) (User, error)
	GetUserByUsername(ctx context.Context, arg GetUserByUsernameParams) (User, error)
	GetVlanByName(ctx context.Context, arg GetVlanByNameParams) (Vlan, error)
	GetVlanByVlanID(ctx context.Context, arg GetVlanByVlanIDParams) (Vlan, error)
	ListActiveAuthSessionsByUserPage(ctx context.Context, arg ListActiveAuthSessionsByUserPageParams) ([]AuthSession, error)
	ListActiveAuthSessionsPage(ctx context.Context, arg ListActiveAuthSessionsPageParams) ([]AuthSession, error)
	ListAuditLogs(ctx context.Context, arg ListAuditLogsParams) ([]AuditLog, error)
	ListAuthSessions(ctx context.Context) ([]AuthSession, error)
	ListAuthSessionsByUserID(ctx context.Context, arg ListAuthSessionsByUserIDParams) ([]AuthSession, error)
	ListNetworkDevices(ctx context.Context) ([]NetworkDevice, error)
	ListVlans(ctx context.Context) ([]Vlan, error)
	RevokeAllActiveAuthSessions(ctx context.Context, arg RevokeAllActiveAuthSessionsParams) (int64, error)
	RevokeAuthSession(ctx context.Context, arg RevokeAuthSessionParams) (AuthSession, error)
	RevokeAuthSessionFamily(ctx context.Context, arg RevokeAuthSessionFamilyParams) (int64, error)
	RevokeOtherAuthSessionsForUser(ctx context.Context, arg RevokeOtherAuthSessionsForUserParams) (int64, error)
	TouchAuthSession(ctx context.Context, arg TouchAuthSessionParams) (AuthSession, error)
	UpdateAuthDeviceAuthorizationStatus(ctx context.Context, arg UpdateAuthDeviceAuthorizationStatusParams) (AuthDeviceAuthorization, error)
	UpdateNetworkDevice(ctx context.Context, arg UpdateNetworkDeviceParams) (NetworkDevice, error)
	UpdateVlan(ctx context.Context, arg UpdateVlanParams) (Vlan, error)
	UpsertUserByUsername(ctx context.Context, arg UpsertUserByUsernameParams) (User, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CountActiveAuthSessions

func (q *Queries) CountActiveAuthSessions(ctx context.Context) (int64, error)

func (*Queries) CountActiveAuthSessionsByUserID

func (q *Queries) CountActiveAuthSessionsByUserID(ctx context.Context, arg CountActiveAuthSessionsByUserIDParams) (int64, error)

func (*Queries) CountAuditLogs

func (q *Queries) CountAuditLogs(ctx context.Context, arg CountAuditLogsParams) (int64, error)

func (*Queries) CountNetworkDevices

func (q *Queries) CountNetworkDevices(ctx context.Context) (int64, error)

func (*Queries) CountVlans

func (q *Queries) CountVlans(ctx context.Context) (int64, error)

func (*Queries) CreateAuditLog

func (q *Queries) CreateAuditLog(ctx context.Context, arg CreateAuditLogParams) (AuditLog, error)

func (*Queries) CreateAuthDeviceAuthorization

func (q *Queries) CreateAuthDeviceAuthorization(ctx context.Context, arg CreateAuthDeviceAuthorizationParams) (AuthDeviceAuthorization, error)

func (*Queries) CreateAuthSession

func (q *Queries) CreateAuthSession(ctx context.Context, arg CreateAuthSessionParams) (AuthSession, error)

func (*Queries) CreateNetworkDevice

func (q *Queries) CreateNetworkDevice(ctx context.Context, arg CreateNetworkDeviceParams) (NetworkDevice, error)

func (*Queries) CreateVlan

func (q *Queries) CreateVlan(ctx context.Context, arg CreateVlanParams) (Vlan, error)

func (*Queries) DeleteNetworkDevice

func (q *Queries) DeleteNetworkDevice(ctx context.Context, arg DeleteNetworkDeviceParams) error

func (*Queries) DeleteVlan

func (q *Queries) DeleteVlan(ctx context.Context, arg DeleteVlanParams) error

func (*Queries) GetAuthSessionByID

func (q *Queries) GetAuthSessionByID(ctx context.Context, arg GetAuthSessionByIDParams) (AuthSession, error)

func (*Queries) GetAuthSessionByRefreshTokenHash

func (q *Queries) GetAuthSessionByRefreshTokenHash(ctx context.Context, arg GetAuthSessionByRefreshTokenHashParams) (AuthSession, error)

func (*Queries) GetNetworkDeviceByID

func (q *Queries) GetNetworkDeviceByID(ctx context.Context, arg GetNetworkDeviceByIDParams) (NetworkDevice, error)

func (*Queries) GetNetworkDeviceByMACAddress

func (q *Queries) GetNetworkDeviceByMACAddress(ctx context.Context, arg GetNetworkDeviceByMACAddressParams) (NetworkDevice, error)

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, arg GetUserByIDParams) (User, error)

func (*Queries) GetUserByUsername

func (q *Queries) GetUserByUsername(ctx context.Context, arg GetUserByUsernameParams) (User, error)

func (*Queries) GetVlanByName

func (q *Queries) GetVlanByName(ctx context.Context, arg GetVlanByNameParams) (Vlan, error)

func (*Queries) GetVlanByVlanID

func (q *Queries) GetVlanByVlanID(ctx context.Context, arg GetVlanByVlanIDParams) (Vlan, error)

func (*Queries) ListActiveAuthSessionsByUserPage

func (q *Queries) ListActiveAuthSessionsByUserPage(ctx context.Context, arg ListActiveAuthSessionsByUserPageParams) ([]AuthSession, error)

func (*Queries) ListActiveAuthSessionsPage

func (q *Queries) ListActiveAuthSessionsPage(ctx context.Context, arg ListActiveAuthSessionsPageParams) ([]AuthSession, error)

func (*Queries) ListAuditLogs

func (q *Queries) ListAuditLogs(ctx context.Context, arg ListAuditLogsParams) ([]AuditLog, error)

func (*Queries) ListAuthSessions

func (q *Queries) ListAuthSessions(ctx context.Context) ([]AuthSession, error)

func (*Queries) ListAuthSessionsByUserID

func (q *Queries) ListAuthSessionsByUserID(ctx context.Context, arg ListAuthSessionsByUserIDParams) ([]AuthSession, error)

func (*Queries) ListNetworkDevices

func (q *Queries) ListNetworkDevices(ctx context.Context) ([]NetworkDevice, error)

func (*Queries) ListVlans

func (q *Queries) ListVlans(ctx context.Context) ([]Vlan, error)

func (*Queries) RevokeAllActiveAuthSessions

func (q *Queries) RevokeAllActiveAuthSessions(ctx context.Context, arg RevokeAllActiveAuthSessionsParams) (int64, error)

func (*Queries) RevokeAuthSession

func (q *Queries) RevokeAuthSession(ctx context.Context, arg RevokeAuthSessionParams) (AuthSession, error)

func (*Queries) RevokeAuthSessionFamily

func (q *Queries) RevokeAuthSessionFamily(ctx context.Context, arg RevokeAuthSessionFamilyParams) (int64, error)

func (*Queries) RevokeOtherAuthSessionsForUser

func (q *Queries) RevokeOtherAuthSessionsForUser(ctx context.Context, arg RevokeOtherAuthSessionsForUserParams) (int64, error)

func (*Queries) TouchAuthSession

func (q *Queries) TouchAuthSession(ctx context.Context, arg TouchAuthSessionParams) (AuthSession, error)

func (*Queries) UpdateNetworkDevice

func (q *Queries) UpdateNetworkDevice(ctx context.Context, arg UpdateNetworkDeviceParams) (NetworkDevice, error)

func (*Queries) UpdateVlan

func (q *Queries) UpdateVlan(ctx context.Context, arg UpdateVlanParams) (Vlan, error)

func (*Queries) UpsertUserByUsername

func (q *Queries) UpsertUserByUsername(ctx context.Context, arg UpsertUserByUsernameParams) (User, error)

func (*Queries) WithTx

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

type RevokeAllActiveAuthSessionsParams

type RevokeAllActiveAuthSessionsParams struct {
	RevokeReason string `db:"revoke_reason" json:"revoke_reason"`
}

type RevokeAuthSessionFamilyParams

type RevokeAuthSessionFamilyParams struct {
	RevokeReason         string      `db:"revoke_reason" json:"revoke_reason"`
	RefreshTokenFamilyID pgtype.UUID `db:"refresh_token_family_id" json:"refresh_token_family_id"`
}

type RevokeAuthSessionParams

type RevokeAuthSessionParams struct {
	RevokeReason string      `db:"revoke_reason" json:"revoke_reason"`
	ID           pgtype.UUID `db:"id" json:"id"`
}

type RevokeOtherAuthSessionsForUserParams

type RevokeOtherAuthSessionsForUserParams struct {
	RevokeReason string      `db:"revoke_reason" json:"revoke_reason"`
	UserID       pgtype.UUID `db:"user_id" json:"user_id"`
	ID           pgtype.UUID `db:"id" json:"id"`
}

type TouchAuthSessionParams

type TouchAuthSessionParams struct {
	LastUsedAt    pgtype.Timestamptz `db:"last_used_at" json:"last_used_at"`
	IdleExpiresAt pgtype.Timestamptz `db:"idle_expires_at" json:"idle_expires_at"`
	ID            pgtype.UUID        `db:"id" json:"id"`
}

type UpdateAuthDeviceAuthorizationStatusParams

type UpdateAuthDeviceAuthorizationStatusParams struct {
	Status           string             `db:"status" json:"status"`
	ApprovedByUserID pgtype.UUID        `db:"approved_by_user_id" json:"approved_by_user_id"`
	ApprovedAt       pgtype.Timestamptz `db:"approved_at" json:"approved_at"`
	LastPolledAt     pgtype.Timestamptz `db:"last_polled_at" json:"last_polled_at"`
	ID               pgtype.UUID        `db:"id" json:"id"`
}

type UpdateNetworkDeviceParams

type UpdateNetworkDeviceParams struct {
	MacAddress      string      `db:"mac_address" json:"mac_address"`
	DisplayName     string      `db:"display_name" json:"display_name"`
	Disabled        bool        `db:"disabled" json:"disabled"`
	VlanID          int32       `db:"vlan_id" json:"vlan_id"`
	UpdatedByUserID pgtype.UUID `db:"updated_by_user_id" json:"updated_by_user_id"`
	ID              pgtype.UUID `db:"id" json:"id"`
}

type UpdateVlanParams

type UpdateVlanParams struct {
	VlanID        int32  `db:"vlan_id" json:"vlan_id"`
	Name          string `db:"name" json:"name"`
	Description   string `db:"description" json:"description"`
	CurrentVlanID int32  `db:"current_vlan_id" json:"current_vlan_id"`
}

type UpsertUserByUsernameParams

type UpsertUserByUsernameParams struct {
	Username string   `db:"username" json:"username"`
	Name     string   `db:"name" json:"name"`
	Email    string   `db:"email" json:"email"`
	Groups   []string `db:"groups" json:"groups"`
}

type User

type User struct {
	ID        pgtype.UUID        `db:"id" json:"id"`
	Username  string             `db:"username" json:"username"`
	Name      string             `db:"name" json:"name"`
	Email     string             `db:"email" json:"email"`
	Groups    []string           `db:"groups" json:"groups"`
	CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
	UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}

type Vlan

type Vlan struct {
	VlanID      int32              `db:"vlan_id" json:"vlan_id"`
	Name        string             `db:"name" json:"name"`
	Description string             `db:"description" json:"description"`
	CreatedAt   pgtype.Timestamptz `db:"created_at" json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}

Jump to

Keyboard shortcuts

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