db

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package db provides mechanisms for interacting with a database directly

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresClient added in v0.31.0

type PostgresClient struct {
	DB sqlx.DB
}

PostgresClient is a postgres client based on sqlx

func NewPostgresClient added in v0.31.0

func NewPostgresClient(host, database, user, password string, port int, use_ssl bool) (*PostgresClient, error)

func NewPostgresClientFromViper added in v0.31.0

func NewPostgresClientFromViper() (*PostgresClient, error)

func (*PostgresClient) DeleteOne added in v0.31.0

func (d *PostgresClient) DeleteOne(asset_id int64) (models.Asset, []int64, error)

DeleteOne deletes one asset identified by asset_id, returning the deleted asset as well as the ids of any asset that was affected by the deletion, and any error encountered.

func (*PostgresClient) Insert added in v0.31.0

func (d *PostgresClient) Insert(assets []models.Asset) ([]models.Asset, error)

func (*PostgresClient) InsertAssetAttributes added in v0.33.0

func (d *PostgresClient) InsertAssetAttributes(assetAttributes []models.AssetAttribute) ([]models.AssetAttribute, error)

func (*PostgresClient) InsertAttributes added in v0.33.0

func (d *PostgresClient) InsertAttributes(attributes []models.Attribute) ([]models.Attribute, error)

func (*PostgresClient) List added in v0.31.0

func (d *PostgresClient) List(deleted bool, pageSize, page int) ([]models.Asset, error)

func (*PostgresClient) ListAssetAttributeValues added in v0.33.0

func (d *PostgresClient) ListAssetAttributeValues(assetID int64) (keyValues []models.KeyValue, err error)

func (*PostgresClient) ListAssetAttributes added in v0.33.0

func (d *PostgresClient) ListAssetAttributes() (assetAttributes []models.AssetAttribute, err error)

func (*PostgresClient) ListAttributes added in v0.33.0

func (d *PostgresClient) ListAttributes() (attributes []models.Attribute, err error)

func (*PostgresClient) ListEvents added in v0.31.0

func (d *PostgresClient) ListEvents() (events []models.Event, err error)

func (*PostgresClient) RecordEvent added in v0.31.0

func (d *PostgresClient) RecordEvent(content string) error

RecordEvent allows inserting into events when an asset or a tag is modified or deleted.

func (*PostgresClient) RestoreOne added in v0.31.0

func (d *PostgresClient) RestoreOne(asset_id int64) (models.Asset, error)

func (*PostgresClient) Seed added in v0.31.0

func (d *PostgresClient) Seed() (sql.Result, error)

func (*PostgresClient) SelectAsset added in v0.31.0

func (d *PostgresClient) SelectAsset(id int64) (models.Asset, error)

func (*PostgresClient) UpdateAssetDescription added in v0.31.0

func (d *PostgresClient) UpdateAssetDescription(assetID int64, description string) (int64, string, error)

func (*PostgresClient) UpdateAssetStatus added in v0.31.0

func (d *PostgresClient) UpdateAssetStatus(assetID int64, status string) (int64, string, error)

func (*PostgresClient) UpdateAssetTarget added in v0.31.0

func (d *PostgresClient) UpdateAssetTarget(assetID, target int64) (int64, int64, error)

Jump to

Keyboard shortcuts

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