haul

package module
v0.127.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: GPL-2.0 Imports: 23 Imported by: 0

README

haulproject/haul
haulproject/haul

Go Reference haul on Codeberg

Inventory management system for patchwork assets.

Status

Experimental project; databases are probably not compatible between versions.

Please do not use in production, as there is no guaranteed stability with the API or the database schema at this moment.

Prerequisites

  • Required: make, docker, docker-compose
  • Recommended: go

Quickstart

For running the app locally (including a db), please use the compose.yaml file together with a .env file (for config through env vars).

At the very least, .env must contain the following (changing to secure values):

# db client config
HAUL_SERVER_API_POSTGRES_USER='haul'
HAUL_SERVER_API_POSTGRES_PASSWORD='change_me'
HAUL_SERVER_API_POSTGRES_DATABASE='haul'

# API creds
HAUL_SERVER_API_KEY='change_me'
HAUL_SERVER_UI_API_KEY="$HAUL_SERVER_API_KEY"

# UI creds
HAUL_SERVER_UI_USERNAME='change_me'
HAUL_SERVER_UI_PASSWORD='change_me'

# db config
POSTGRES_USER="$HAUL_SERVER_API_POSTGRES_USER"
POSTGRES_PASSWORD="$HAUL_SERVER_API_POSTGRES_PASSWORD"
POSTGRES_DATABASE="$HAUL_SERVER_API_POSTGRES_DATABASE"

The stack contains a db, an API server, and a UI server. Both web servers are built from the same source code but expose on different ports.

For manipulating the stack, please use docker compose [command]:

  • docker compose up -d --build
  • docker compose ps
  • docker compose logs api
  • docker compose down (tip: use --volumes to fully cleanup)

Testing

The repo uses automatic tests on codeberg actions using a temporary database for acceptance tests.

For testing the app locally, please use the test.compose.yaml file together with a test.env file (for config through env vars).

At the very least, test.env must contain the following (changing to secure values):

# db client config
HAUL_SERVER_API_POSTGRES_USER='haul'
HAUL_SERVER_API_POSTGRES_PASSWORD='change_me'
HAUL_SERVER_API_POSTGRES_DATABASE='haul'

# db config
POSTGRES_USER="$HAUL_SERVER_API_POSTGRES_USER"
POSTGRES_PASSWORD="$HAUL_SERVER_API_POSTGRES_PASSWORD"
POSTGRES_DATABASE="$HAUL_SERVER_API_POSTGRES_DATABASE"

The test stack contains a db, an image containing go and the source files for running go test -cover, and finally an adminer database client accessible through http://localhost:8080

For manipulating the stack, please use docker compose -f test.compose.yaml [command]:

  • docker compose -f test.compose.yaml up -d --build
  • docker compose -f test.compose.yaml ps
  • docker compose -f test.compose.yaml logs test
  • docker compose -f test.compose.yaml down

API specification

Can only be gathered from the go source files at the moment.

An OpenAPI spec is planned in the future.

Issues

See our codeberg issues

Attributions

The wheelbarrow logo is owned by @ely_martin_6070 and used by the haulproject with permission.

It is licensed under CC BY-NC-SA 4.0. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/

License

This project is distributed under the terms of the GNU General Public License, version 2.

Documentation

Overview

Package haul defines the externally-importable types and functions needed to run haul's API server, UI server and API client.

note: the following docs might be outdated, TODO before releasing v1.

### Source file descriptions

api.go defines the function for starting the API server from a parsed Config.

build.go defines the function to return the semantic version of the app registered at compile time.

client.go defines the APIClient struct and its associated API methods. It requires the injection of a voki.Voki caller to make parameterized JSON requests against an HTTP(S) server.

client_test.go defines tests for making API requests against a haul API server. Expected to be run as part of the repo's `deployments/compose/haul-acceptance/` project.

config.go defines the types and functions needed to populate a Config instance.

db.go defines the PostgresClient type and its associated method for operations against a haul PostgreSQL database.

db_test.go defines tests for a PostgresClient. Expected to be run as part of the repo's `deployments/compose/haul-acceptance` project.

entity.go defines types and constructors for the entities of haul's domain of operation. It includes struct tags on fields for their equivalence in the backing PostgreSQL database using a PostgresClient instance. See the repo's `queries/` for SQL declarations of tables, procedures, and triggers.

handler.go defines the functions called when API endpoints are hit.

response.go defines the structures of JSON HTTP responses. They are used to pass information between the HTTP API (handler.go) and the API client (client.go), which backs the UI server [ui.go], the CLI client (see the repo's `cmd/haul/`), and any custom client.

routes.go defines the functions that can declare the API surface as routes in a echo.Echo. Used by RunAPIServer.

ui.go defines the function for starting the UI server from a parsed Config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAPIServerFlags

func BindAPIServerFlags(set *pflag.FlagSet) error

func BindClientFlags

func BindClientFlags(set *pflag.FlagSet) error

func BindUIServerFlags

func BindUIServerFlags(set *pflag.FlagSet) error

func BindUnstableFlags

func BindUnstableFlags(flagSet *pflag.FlagSet) error

func CountHandler

func CountHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func CreateAssetsHandler

func CreateAssetsHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ListAssetsHandler

func ListAssetsHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ListAssetsLabelsHandler added in v0.111.0

func ListAssetsLabelsHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ListEventsHandler

func ListEventsHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ListKindsHandler

func ListKindsHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ListLabelsHandler added in v0.111.0

func ListLabelsHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ListTemplatesHandler

func ListTemplatesHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func NewAPIServer added in v0.114.0

func NewAPIServer(ctx context.Context, cfg Config, pool *pgxpool.Pool) (*echo.Echo, error)

func ReadAssetHandler

func ReadAssetHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func ReadHealthHandler

func ReadHealthHandler(ctx context.Context, db *PostgresClient) echo.HandlerFunc

func RegisterRoutes

func RegisterRoutes(ctx context.Context, e *echo.Echo, db *PostgresClient) error

func RunAPIServer

func RunAPIServer(ctx context.Context, cfg Config, pool *pgxpool.Pool) error

func RunUIServer

func RunUIServer(ctx context.Context, cfg Config, stdout io.Writer) error

RunUIServer starts an instance of the web panel

It requires access to a config from which it will read the following:

  • cfg.Server.Ui.Host
  • cfg.Server.Ui.Password
  • cfg.Server.Ui.Port
  • cfg.Server.Ui.Username

Some operations also require access to an APIClient, which is built using the following config options:

  • cfg.Server.Ui.Api.Host
  • cfg.Server.Ui.Api.Key
  • cfg.Server.Ui.Api.Port
  • cfg.Server.Ui.Api.Protocol

func StartAPIServerFromEcho added in v0.114.0

func StartAPIServerFromEcho(ctx context.Context, cfg Config, e *echo.Echo) error

func Version

func Version() string

Types

type APIClient

type APIClient struct {
	Voki voki.Caller
}

func (APIClient) Count

func (c APIClient) Count(ctx context.Context) (CountResponse, error)

func (APIClient) CountAssets

func (c APIClient) CountAssets(ctx context.Context) (CountAssetsResponse, error)

func (APIClient) CreateAssets

func (c APIClient) CreateAssets(ctx context.Context, assets ...Asset) (CreateAssetsResponse, error)

func (APIClient) ListAssets

func (c APIClient) ListAssets(ctx context.Context, limit int) (ListAssetsResponse, error)

func (APIClient) ListAssetsLabels added in v0.111.0

func (c APIClient) ListAssetsLabels(ctx context.Context, limit int) (ListAssetsLabelsResponse, error)

func (APIClient) ListEvents

func (c APIClient) ListEvents(ctx context.Context, limit int) (ListEventsResponse, error)

func (APIClient) ListKinds

func (c APIClient) ListKinds(ctx context.Context, limit int) (ListKindsResponse, error)

func (APIClient) ListLabels added in v0.111.0

func (c APIClient) ListLabels(ctx context.Context, limit int) (ListLabelsResponse, error)

func (APIClient) ListTemplates

func (c APIClient) ListTemplates(ctx context.Context, limit int) (ListTemplatesResponse, error)

func (APIClient) ReadAsset

func (c APIClient) ReadAsset(ctx context.Context, assetID uuid.UUID) (ReadAssetResponse, error)

func (APIClient) ReadHealth

func (c APIClient) ReadHealth(ctx context.Context) (ReadHealthResponse, error)

type APIClientConfig

type APIClientConfig struct {
	Host string
	Key  string
	Port int
	TLS  TLSClientConfig
}

type APIServerConfig

type APIServerConfig struct {
	Host     string
	Key      string
	Port     int
	Postgres PostgresConfig
	TLS      TLSServerConfig
}

type Asset

type Asset struct {
	ID   uuid.UUID `db:"id"`
	Name string    `db:"name"`
}

func NewAsset

func NewAsset(name string) Asset

type AssetLabel added in v0.111.0

type AssetLabel struct {
	AssetID uuid.UUID `db:"asset_id"`
	LabelID uuid.UUID `db:"label_id"`
	Value   string    `db:"value"`
}

type AssetTemplateLabel added in v0.120.0

type AssetTemplateLabel struct {
	AssetID    uuid.UUID `db:"asset_id"`
	TemplateID uuid.UUID `db:"template_id"`
	LabelID    uuid.UUID `db:"label_id"`
	Value      string    `db:"value"`
}

type ClientConfig

type ClientConfig struct {
	API         APIClientConfig
	OutputStyle string
}

type Config

type Config struct {
	Client   ClientConfig
	Server   ServerConfig
	Unstable UnstableConfig
}

func ParseConfig

func ParseConfig() (cfg Config, err error)

ParseConfig returns a Config instance filled by viper.ParseConfig

Because of viper.ParseConfig, this will parse the config file or files before parsing the command-line flags.

type CountAssetsResponse

type CountAssetsResponse struct {
	Data struct {
		Count int
	}
	Message string
}

type CountResponse

type CountResponse struct {
	Data struct {
		AssetLabelsCount         int
		AssetTemplateLabelsCount int
		AssetsCount              int
		EventsCount              int
		KindsCount               int
		LabelsCount              int
		PurposesCount            int
		RelationAssetsCount      int
		RelationLabelsCount      int
		RelationsCount           int
		TemplateLabelsCount      int
		TemplatesCount           int
	}
	Message string
}

type CreateAssetsResponse

type CreateAssetsResponse struct {
	Data struct {
		AssetIDs []uuid.UUID
	}
}

type ErrNotImplemented added in v0.113.0

type ErrNotImplemented struct{}

func (ErrNotImplemented) Error added in v0.113.0

func (e ErrNotImplemented) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error string
}

func ErrorRespondf

func ErrorRespondf(format string, a ...any) ErrorResponse

type Event

type Event struct {
	ID      uuid.UUID  `db:"id"`
	At      *time.Time `db:"at"`
	Content string     `db:"content"`
}

Events are created by triggers

type Kind

type Kind struct {
	ID    uuid.UUID `db:"id"`
	Name  string    `db:"name"`
	Regex string    `db:"regex"`
}

func NewKind

func NewKind(name, regex string) Kind

type Label added in v0.111.0

type Label struct {
	ID     uuid.UUID  `db:"id"`
	Name   string     `db:"name"`
	KindID *uuid.UUID `db:"kind_id"`
}

func NewLabel added in v0.111.0

func NewLabel(name string, kindID *uuid.UUID) Label

type ListAssetsLabelsResponse added in v0.111.0

type ListAssetsLabelsResponse struct {
	Data struct {
		AssetsLabels []AssetLabel
	}
}

type ListAssetsResponse

type ListAssetsResponse struct {
	Data struct {
		Assets []Asset
	}
}

type ListEventsResponse

type ListEventsResponse struct {
	Data struct {
		Events []Event
	}
}

type ListKindsResponse

type ListKindsResponse struct {
	Data struct {
		Kinds []Kind
	}
}

type ListLabelsResponse added in v0.111.0

type ListLabelsResponse struct {
	Data struct {
		Labels []Label
	}
}

type ListTemplatesResponse

type ListTemplatesResponse struct {
	Data struct {
		Templates []Template
	}
}

type PostgresClient

type PostgresClient struct {
	Pool *pgxpool.Pool
}

func (*PostgresClient) AssignAssetLabel added in v0.122.0

func (c *PostgresClient) AssignAssetLabel(ctx context.Context, assetID, labelID uuid.UUID, value string) error

asset_label_assigned

func (*PostgresClient) AssignAssetTemplateLabel added in v0.122.0

func (c *PostgresClient) AssignAssetTemplateLabel(ctx context.Context, assetID, templateID, labelID uuid.UUID, value string) error

asset_template_label_assigned

func (*PostgresClient) AssignRelationAsset added in v0.122.0

func (c *PostgresClient) AssignRelationAsset(ctx context.Context, relationID, assetID, purposeID uuid.UUID) error

relation_asset_assigned

func (*PostgresClient) AssignRelationLabel added in v0.122.0

func (c *PostgresClient) AssignRelationLabel(ctx context.Context, relationID, labelID uuid.UUID, value string) error

relation_label_assigned

func (*PostgresClient) AssignTemplateLabel added in v0.122.0

func (c *PostgresClient) AssignTemplateLabel(ctx context.Context, templateID, labelID uuid.UUID, value string) error

template_label_assigned

func (*PostgresClient) Count

func (c *PostgresClient) Count(ctx context.Context) (assetsCount, eventsCount, kindsCount, labelsCount, purposesCount, relationsCount, templatesCount, assetLabelsCount, assetTemplateLabelsCount, relationAssetsCount, relationLabelsCount, templateLabelsCount int, err error)

func (*PostgresClient) CreateAssets

func (c *PostgresClient) CreateAssets(ctx context.Context, assets ...Asset) (assetIDs []uuid.UUID, err error)

asset_created

func (*PostgresClient) CreateKinds added in v0.113.0

func (c *PostgresClient) CreateKinds(ctx context.Context, kinds ...Kind) (kindIDs []uuid.UUID, err error)

kind_created

func (*PostgresClient) CreateLabels added in v0.113.0

func (c *PostgresClient) CreateLabels(ctx context.Context, labels ...Label) (labelIDs []uuid.UUID, err error)

label_created

func (*PostgresClient) CreatePurposes added in v0.122.0

func (c *PostgresClient) CreatePurposes(ctx context.Context, purposes ...Purpose) (purposeIDs []uuid.UUID, err error)

purpose_created

func (*PostgresClient) CreateRelations added in v0.122.0

func (c *PostgresClient) CreateRelations(ctx context.Context, relations ...Relation) (relationIDs []uuid.UUID, err error)

relation_created

func (*PostgresClient) CreateTemplates added in v0.113.0

func (c *PostgresClient) CreateTemplates(ctx context.Context, templates ...Template) (templateIDs []uuid.UUID, err error)

template_created

func (*PostgresClient) DeleteAssets added in v0.122.0

func (c *PostgresClient) DeleteAssets(ctx context.Context, assetIDs ...uuid.UUID) error

asset_deleted

func (*PostgresClient) DeleteKinds added in v0.122.0

func (c *PostgresClient) DeleteKinds(ctx context.Context, kindIDs ...uuid.UUID) error

kind_deleted

func (*PostgresClient) DeleteLabels added in v0.122.0

func (c *PostgresClient) DeleteLabels(ctx context.Context, labelIDs ...uuid.UUID) error

label_deleted

func (*PostgresClient) DeletePurposes added in v0.122.0

func (c *PostgresClient) DeletePurposes(ctx context.Context, purposeIDs ...uuid.UUID) error

purpose_deleted

func (*PostgresClient) DeleteRelations added in v0.122.0

func (c *PostgresClient) DeleteRelations(ctx context.Context, relationIDs ...uuid.UUID) error

relation_deleted

func (*PostgresClient) DeleteTemplates added in v0.122.0

func (c *PostgresClient) DeleteTemplates(ctx context.Context, templateIDs ...uuid.UUID) error

template_deleted

func (*PostgresClient) ExecCreateSchema

func (c *PostgresClient) ExecCreateSchema(ctx context.Context) error

ExecCreateSchema creates tables from definitions in sql/schema.sql

func (*PostgresClient) ExecCreateTriggers

func (c *PostgresClient) ExecCreateTriggers(ctx context.Context) error

ExecCreateTriggers creates triggers and their associated trigger function stored in sql/trigger.sql

func (*PostgresClient) ExecCreateViews added in v0.124.0

func (c *PostgresClient) ExecCreateViews(ctx context.Context) error

func (*PostgresClient) GetAsset added in v0.122.0

func (c *PostgresClient) GetAsset(ctx context.Context, id uuid.UUID) (Asset, error)

func (*PostgresClient) GetAssetLabel added in v0.122.0

func (c *PostgresClient) GetAssetLabel(ctx context.Context, assetID, labelID uuid.UUID) (AssetLabel, error)

func (*PostgresClient) GetAssetLabelValue added in v0.122.0

func (c *PostgresClient) GetAssetLabelValue(ctx context.Context, assetID, labelID uuid.UUID) (string, error)

GetAssetLabelValue

func (*PostgresClient) GetAssetName added in v0.122.0

func (c *PostgresClient) GetAssetName(ctx context.Context, id uuid.UUID) (string, error)

func (*PostgresClient) GetAssetTemplateLabel added in v0.122.0

func (c *PostgresClient) GetAssetTemplateLabel(ctx context.Context, assetID, templateID, labelID uuid.UUID) (AssetTemplateLabel, error)

func (*PostgresClient) GetAssetTemplateLabelValue added in v0.122.0

func (c *PostgresClient) GetAssetTemplateLabelValue(ctx context.Context, assetID, templateID, labelID uuid.UUID) (string, error)

GetAssetTemplateLabelValue

func (*PostgresClient) GetEvent added in v0.122.0

func (c *PostgresClient) GetEvent(ctx context.Context, id uuid.UUID) (Event, error)

func (*PostgresClient) GetEventAt added in v0.122.0

func (c *PostgresClient) GetEventAt(ctx context.Context, id uuid.UUID) (*time.Time, error)

GetEventAt

func (*PostgresClient) GetEventContent added in v0.122.0

func (c *PostgresClient) GetEventContent(ctx context.Context, id uuid.UUID) (string, error)

GetEventContent

func (*PostgresClient) GetKind added in v0.122.0

func (c *PostgresClient) GetKind(ctx context.Context, id uuid.UUID) (Kind, error)

func (*PostgresClient) GetKindName added in v0.122.0

func (c *PostgresClient) GetKindName(ctx context.Context, id uuid.UUID) (string, error)

func (*PostgresClient) GetKindRegex added in v0.122.0

func (c *PostgresClient) GetKindRegex(ctx context.Context, id uuid.UUID) (string, error)

GetKindRegex

func (*PostgresClient) GetLabel added in v0.122.0

func (c *PostgresClient) GetLabel(ctx context.Context, id uuid.UUID) (Label, error)

func (*PostgresClient) GetLabelKind added in v0.122.0

func (c *PostgresClient) GetLabelKind(ctx context.Context, id uuid.UUID) (Kind, error)

GetLabelKind

func (*PostgresClient) GetLabelKindID added in v0.122.0

func (c *PostgresClient) GetLabelKindID(ctx context.Context, id uuid.UUID) (*uuid.UUID, error)

GetLabelKindID

func (*PostgresClient) GetLabelName added in v0.122.0

func (c *PostgresClient) GetLabelName(ctx context.Context, id uuid.UUID) (string, error)

func (*PostgresClient) GetPurpose added in v0.122.0

func (c *PostgresClient) GetPurpose(ctx context.Context, id uuid.UUID) (Purpose, error)

func (*PostgresClient) GetPurposeName added in v0.122.0

func (c *PostgresClient) GetPurposeName(ctx context.Context, id uuid.UUID) (string, error)

func (*PostgresClient) GetRelation added in v0.122.0

func (c *PostgresClient) GetRelation(ctx context.Context, id uuid.UUID) (Relation, error)

func (*PostgresClient) GetRelationAsset added in v0.122.0

func (c *PostgresClient) GetRelationAsset(ctx context.Context, relationID, assetID, purposeID uuid.UUID) (RelationAsset, error)

func (*PostgresClient) GetRelationAssetPurpose added in v0.122.0

func (c *PostgresClient) GetRelationAssetPurpose(ctx context.Context, id uuid.UUID) (Purpose, error)

GetRelationAssetPurpose

func (*PostgresClient) GetRelationAssetPurposeID added in v0.122.0

func (c *PostgresClient) GetRelationAssetPurposeID(ctx context.Context, relationID, assetID uuid.UUID) (*uuid.UUID, error)

GetRelationAssetPurposeID

func (*PostgresClient) GetRelationLabel added in v0.122.0

func (c *PostgresClient) GetRelationLabel(ctx context.Context, relationID, labelID uuid.UUID) (RelationLabel, error)

func (*PostgresClient) GetRelationLabelValue added in v0.122.0

func (c *PostgresClient) GetRelationLabelValue(ctx context.Context, relationID, labelID uuid.UUID) (string, error)

GetRelationLabelValue

func (*PostgresClient) GetRelationName added in v0.122.0

func (c *PostgresClient) GetRelationName(ctx context.Context, id uuid.UUID) (string, error)

func (*PostgresClient) GetTemplate added in v0.122.0

func (c *PostgresClient) GetTemplate(ctx context.Context, id uuid.UUID) (Template, error)

func (*PostgresClient) GetTemplateLabel added in v0.122.0

func (c *PostgresClient) GetTemplateLabel(ctx context.Context, templateID, labelID uuid.UUID) (TemplateLabel, error)

func (*PostgresClient) GetTemplateLabelValue added in v0.122.0

func (c *PostgresClient) GetTemplateLabelValue(ctx context.Context, templateID, labelID uuid.UUID) (string, error)

GetTemplateLabelValue

func (*PostgresClient) GetTemplateName added in v0.122.0

func (c *PostgresClient) GetTemplateName(ctx context.Context, id uuid.UUID) (string, error)

func (*PostgresClient) Init

func (c *PostgresClient) Init(ctx context.Context) error

func (*PostgresClient) ListAssets

func (c *PostgresClient) ListAssets(ctx context.Context, limit, offset int, filter string) ([]Asset, error)

API Surface asset ListAssets

func (*PostgresClient) ListAssetsLabels added in v0.111.0

func (c *PostgresClient) ListAssetsLabels(ctx context.Context, limit, offset int, filter string) ([]AssetLabel, error)

ListAssetsLabels

func (*PostgresClient) ListAssetsTemplatesLabels added in v0.123.0

func (c *PostgresClient) ListAssetsTemplatesLabels(ctx context.Context, limit, offset int, filter string) ([]AssetTemplateLabel, error)

ListAssetsTemplatesLabels

func (*PostgresClient) ListEvents

func (c *PostgresClient) ListEvents(ctx context.Context, limit, offset int, filter string) ([]Event, error)

ListEvents

func (*PostgresClient) ListKinds

func (c *PostgresClient) ListKinds(ctx context.Context, limit, offset int, filter string) ([]Kind, error)

ListKinds

func (*PostgresClient) ListLabels added in v0.111.0

func (c *PostgresClient) ListLabels(ctx context.Context, limit, offset int, filter string) ([]Label, error)

ListLabels

func (*PostgresClient) ListPurposes added in v0.122.0

func (c *PostgresClient) ListPurposes(ctx context.Context, limit, offset int, filter string) ([]Purpose, error)

ListPurposes

func (*PostgresClient) ListRelations added in v0.116.2

func (c *PostgresClient) ListRelations(ctx context.Context, limit, offset int, filter string) ([]Relation, error)

ListRelations

func (*PostgresClient) ListRelationsAssets added in v0.123.0

func (c *PostgresClient) ListRelationsAssets(ctx context.Context, limit, offset int, filter string) ([]RelationAsset, error)

ListRelationsAssets

func (*PostgresClient) ListRelationsLabels added in v0.123.0

func (c *PostgresClient) ListRelationsLabels(ctx context.Context, limit, offset int, filter string) ([]RelationLabel, error)

ListRelationsLabels

func (*PostgresClient) ListTemplates

func (c *PostgresClient) ListTemplates(ctx context.Context, limit, offset int, filter string) ([]Template, error)

ListTemplates

func (*PostgresClient) ListTemplatesLabels added in v0.123.0

func (c *PostgresClient) ListTemplatesLabels(ctx context.Context, limit, offset int, filter string) ([]TemplateLabel, error)

ListTemplatesLabels

func (*PostgresClient) UnassignAssetLabel added in v0.122.0

func (c *PostgresClient) UnassignAssetLabel(ctx context.Context, assetID, labelID uuid.UUID) error

asset_label_unassigned

func (*PostgresClient) UnassignAssetTemplateLabel added in v0.122.0

func (c *PostgresClient) UnassignAssetTemplateLabel(ctx context.Context, assetID, templateID, labelID uuid.UUID) error

asset_template_label_unassigned

func (*PostgresClient) UnassignRelationAsset added in v0.122.0

func (c *PostgresClient) UnassignRelationAsset(ctx context.Context, relationID, assetID, purposeID uuid.UUID) error

relation_asset_unassigned

func (*PostgresClient) UnassignRelationLabel added in v0.122.0

func (c *PostgresClient) UnassignRelationLabel(ctx context.Context, relationID, labelID uuid.UUID) error

relation_label_unassigned

func (*PostgresClient) UnassignTemplateLabel added in v0.122.0

func (c *PostgresClient) UnassignTemplateLabel(ctx context.Context, templateID, labelID uuid.UUID) error

template_label_unassigned

func (*PostgresClient) UpdateAssetLabelValue added in v0.111.0

func (c *PostgresClient) UpdateAssetLabelValue(ctx context.Context, assetID uuid.UUID, labelID uuid.UUID, value string) error

asset_label_value_updated

func (*PostgresClient) UpdateAssetName

func (c *PostgresClient) UpdateAssetName(ctx context.Context, assetID uuid.UUID, name string) error

asset_name_updated

func (*PostgresClient) UpdateAssetTemplateLabelValue added in v0.122.0

func (c *PostgresClient) UpdateAssetTemplateLabelValue(ctx context.Context, assetID, templateID, labelID uuid.UUID, value string) error

asset_template_label_value_updated

func (*PostgresClient) UpdateKindName

func (c *PostgresClient) UpdateKindName(ctx context.Context, kindID uuid.UUID, name string) error

kind_name_updated

func (*PostgresClient) UpdateKindRegex added in v0.111.0

func (c *PostgresClient) UpdateKindRegex(ctx context.Context, kindID uuid.UUID, regex string) error

kind_regex_updated

func (*PostgresClient) UpdateLabelKind added in v0.111.0

func (c *PostgresClient) UpdateLabelKind(ctx context.Context, labelID, kindID uuid.UUID) error

label_kind_id_updated

func (*PostgresClient) UpdateLabelName added in v0.111.0

func (c *PostgresClient) UpdateLabelName(ctx context.Context, labelID uuid.UUID, name string) error

label_name_updated

func (*PostgresClient) UpdatePurposeName added in v0.122.0

func (c *PostgresClient) UpdatePurposeName(ctx context.Context, purposeID uuid.UUID, name string) error

purpose_name_updated

func (*PostgresClient) UpdateRelationLabelValue added in v0.122.0

func (c *PostgresClient) UpdateRelationLabelValue(ctx context.Context, relationID uuid.UUID, labelID uuid.UUID, value string) error

relation_label_value_updated

func (*PostgresClient) UpdateRelationName added in v0.122.0

func (c *PostgresClient) UpdateRelationName(ctx context.Context, relationID uuid.UUID, name string) error

relation_name_updated

func (*PostgresClient) UpdateTemplateLabelValue added in v0.122.0

func (c *PostgresClient) UpdateTemplateLabelValue(ctx context.Context, templateID uuid.UUID, labelID uuid.UUID, value string) error

template_label_value_updated

func (*PostgresClient) UpdateTemplateName added in v0.122.0

func (c *PostgresClient) UpdateTemplateName(ctx context.Context, templateID uuid.UUID, name string) error

template_name_updated

type PostgresConfig

type PostgresConfig struct {
	Database string
	Host     string
	Password string
	Port     int
	SSLMode  string
	User     string
}

type Purpose added in v0.120.0

type Purpose struct {
	ID   uuid.UUID `db:"id"`
	Name string    `db:"name"`
}

func NewPurpose added in v0.120.0

func NewPurpose(name string) Purpose

type ReadAssetResponse

type ReadAssetResponse struct {
	Data struct {
		Asset Asset
	}
}

type ReadHealthResponse

type ReadHealthResponse struct {
	Data struct {
		PostgresPing bool
		Version      string
	}
	Message string
}

type Relation added in v0.116.0

type Relation struct {
	ID   uuid.UUID `db:"id"`
	Name string    `db:"name"`
}

func NewRelation added in v0.116.0

func NewRelation(name string) Relation

type RelationAsset added in v0.117.0

type RelationAsset struct {
	RelationID uuid.UUID `db:"relation_id"`
	AssetID    uuid.UUID `db:"asset_id"`
	PurposeID  uuid.UUID `db:"purpose_id"`
}

type RelationLabel added in v0.116.0

type RelationLabel struct {
	RelationID uuid.UUID `db:"relation_id"`
	LabelID    uuid.UUID `db:"label_id"`
	Value      string    `db:"value"`
}

type ServerConfig

type ServerConfig struct {
	API APIServerConfig
	UI  UIServerConfig
}

type TLSClientConfig

type TLSClientConfig struct {
	Enabled    bool
	SkipVerify bool
}

type TLSServerConfig

type TLSServerConfig struct {
	CertFile string
	Enabled  bool
	KeyFile  string
}

type Template

type Template struct {
	ID   uuid.UUID `db:"id"`
	Name string    `db:"name"`
}

func NewTemplate

func NewTemplate(name string) Template

type TemplateLabel added in v0.120.0

type TemplateLabel struct {
	TemplateID uuid.UUID `db:"template_id"`
	LabelID    uuid.UUID `db:"label_id"`
	Value      string    `db:"value"`
}

type UIServerConfig

type UIServerConfig struct {
	API      APIClientConfig
	Host     string
	Password string
	Port     int
	TLS      TLSServerConfig
	Username string
}

type UnstableConfig

type UnstableConfig struct {
	Postgres PostgresConfig
}

Directories

Path Synopsis
cmd
haul command
Haul is an inventory management system available as a CLI, web UI and API server.
Haul is an inventory management system available as a CLI, web UI and API server.
ui

Jump to

Keyboard shortcuts

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