node

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetNodeQueryWithContainers = `` /* 136-byte string literal not displayed */

	ListNodesQueryWithContainers = `
		SELECT n.id, n.status, c.id, c.node_id, c.image, c.status
		FROM node n
		LEFT JOIN container c ON n.id = c.node_id`
	AddNodeQuery    = "INSERT INTO node(id, status) VALUES($1, $2)"
	UpdateNodeQuery = "UPDATE node SET status = $1 WHERE id = $2"
	DeleteNodeQuery = "DELETE FROM node WHERE id = $1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	GetNode(ctx context.Context, id uuid.UUID) (*entity.Node, error)
	ListNodes(ctx context.Context) ([]*entity.Node, error)
	AddNode(ctx context.Context) (*entity.Node, error)
	UpdateNode(ctx context.Context, node *entity.Node) error
	DeleteNode(ctx context.Context, id uuid.UUID) error
}

type Service

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

func NewService

func NewService(db *pgxpool.Pool) *Service

func (*Service) AddNode

func (s *Service) AddNode(ctx context.Context) (*entity.Node, error)

func (*Service) DeleteNode

func (s *Service) DeleteNode(ctx context.Context, id uuid.UUID) error

func (*Service) GetNode

func (s *Service) GetNode(ctx context.Context, id uuid.UUID) (*entity.Node, error)

func (*Service) ListNodes

func (s *Service) ListNodes(ctx context.Context) ([]*entity.Node, error)

func (*Service) UpdateNode

func (s *Service) UpdateNode(ctx context.Context, node *entity.Node) error

Jump to

Keyboard shortcuts

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