search

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package search provides FTS and relation-aware catalog browsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressRange added in v0.4.0

type AddressRange struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type AddressUse added in v0.4.0

type AddressUse struct {
	Address  string `json:"address"`
	IPID     string `json:"ip_id"`
	HostID   string `json:"host_id"`
	Gateway  bool   `json:"gateway,omitempty"`
	DHCP     bool   `json:"dhcp,omitempty"`
	Conflict bool   `json:"conflict,omitempty"`
}

AddressUse 保留每条登记记录,避免重复地址被集合去重后隐藏冲突。

type Edge

type Edge struct {
	From string `json:"from"`
	To   string `json:"to"`
	Kind string `json:"kind"`
}

type Inventory

type Inventory struct {
	ID        string            `json:"id"`
	Hosts     []string          `json:"hosts,omitempty"`
	Services  []string          `json:"services,omitempty"`
	IPs       []string          `json:"ips,omitempty"`
	RouterID  string            `json:"router_id,omitempty"`
	Occupancy *NetworkOccupancy `json:"occupancy,omitempty"`
}

type NetworkOccupancy added in v0.4.0

type NetworkOccupancy struct {
	CIDR          string         `json:"cidr"`
	Gateway       string         `json:"gateway,omitempty"`
	DHCPRange     string         `json:"dhcp_range,omitempty"`
	Used          []AddressUse   `json:"used"`
	Free          []AddressRange `json:"free"`
	NextAvailable string         `json:"next_available,omitempty"`
}

type Result

type Result struct {
	ID         string   `json:"id"`
	Type       string   `json:"type"`
	Name       string   `json:"name"`
	Status     string   `json:"status"`
	SiteID     string   `json:"site_id,omitempty"`
	NetworkID  string   `json:"network_id,omitempty"`
	RouterID   string   `json:"router_id,omitempty"`
	HostID     string   `json:"host_id,omitempty"`
	RelatedIDs []string `json:"related_ids,omitempty"`
	// contains filtered or unexported fields
}

type Site

type Site struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Locations []string `json:"locations"`
	Uplinks   []string `json:"uplinks"`
	Networks  []string `json:"networks"`
	Hosts     []string `json:"hosts"`
	Routers   []string `json:"routers"`
}

type Store

type Store struct{ DB *sql.DB }

func (Store) ByHost

func (s Store) ByHost(ctx context.Context, id string) (Inventory, error)

func (Store) ByNetwork

func (s Store) ByNetwork(ctx context.Context, id string) (Inventory, error)

func (Store) GetSite

func (s Store) GetSite(ctx context.Context, idOrName string) (Site, error)

func (Store) NetworkOccupancy added in v0.4.0

func (s Store) NetworkOccupancy(ctx context.Context, id string) (NetworkOccupancy, error)

func (Store) Search

func (s Store) Search(ctx context.Context, q string) ([]Result, error)

Search combines tokenized FTS with bounded IP and exact port matching.

func (Store) Topology

func (s Store) Topology(ctx context.Context, center string, depth int) (Topology, error)

func (Store) TopologyView added in v0.4.0

func (s Store) TopologyView(ctx context.Context, center string, depth int, view string) (Topology, error)

TopologyView 保留旧拓扑的 nodes/edges 字段,并提供图形展示所需的节点详情。

type Topology

type Topology struct {
	Center  string         `json:"center"`
	Nodes   []string       `json:"nodes"`
	Edges   []Edge         `json:"edges"`
	Details []TopologyNode `json:"details"`
}

type TopologyNode added in v0.4.0

type TopologyNode struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Type   string `json:"type"`
	Status string `json:"status"`
	Kind   string `json:"kind,omitempty"`
}

Jump to

Keyboard shortcuts

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