group

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeleteReferenced = errors.New("proxy group is referenced by other resources")
View Source
var ErrNameRequired = errors.New("name is required")
View Source
var ErrNotFound = errors.New("proxy group not found")

Functions

func SelectNodeIDs

func SelectNodeIDs(script string, nodes []ProxyNodeView) ([]int64, error)

Types

type CreateGroupInput

type CreateGroupInput struct {
	Name   string `json:"name"`
	Script string `json:"script"`
}

type Handler

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

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux)

type ProxyGroup

type ProxyGroup struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Script    string    `json:"script"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type ProxyNodeView

type ProxyNodeView struct {
	ID           int64  `json:"id"`
	ProviderName string `json:"providerName"`
	Name         string `json:"name"`
}

type Repository

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

func NewRepository

func NewRepository(db *sql.DB) *Repository

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, g ProxyGroup) (ProxyGroup, error)

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id int64) error

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, id int64) (ProxyGroup, error)

func (*Repository) List

func (r *Repository) List(ctx context.Context) ([]ProxyGroup, error)

func (*Repository) ListProxyNodeViews

func (r *Repository) ListProxyNodeViews(ctx context.Context) ([]ProxyNodeView, error)

func (*Repository) ListRawNodesByProviders

func (r *Repository) ListRawNodesByProviders(ctx context.Context, providerIDs []int64) ([]ResolvedNode, error)

func (*Repository) Update

func (r *Repository) Update(ctx context.Context, g ProxyGroup) (ProxyGroup, error)

type ResolvedNode

type ResolvedNode struct {
	ID           int64  `json:"id"`
	ProviderID   int64  `json:"provider_id"`
	ProviderName string `json:"providerName"`
	Name         string `json:"name"`
	RawYAML      string `json:"raw_yaml"`
}

type Service

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

func NewService

func NewService(repo *Repository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, in CreateGroupInput) (ProxyGroup, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id int64) error

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, id int64) (ProxyGroup, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]ProxyGroup, error)

func (*Service) ListNodes

func (s *Service) ListNodes(ctx context.Context, groupID int64) ([]ProxyNodeView, error)

func (*Service) ResolveNodesForOutput

func (s *Service) ResolveNodesForOutput(ctx context.Context, groupID int64, allowedProviderIDs []int64) ([]string, []map[string]any, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id int64, in UpdateGroupInput) (ProxyGroup, error)

type UpdateGroupInput

type UpdateGroupInput struct {
	Name   string `json:"name"`
	Script string `json:"script"`
}

Jump to

Keyboard shortcuts

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