Documentation
¶
Overview ¶
Package db provides mechanisms for interacting with a database directly
Index ¶
- type PostgresClient
- func (d *PostgresClient) DeleteOne(asset_id int64) (models.Asset, []int64, error)
- func (d *PostgresClient) Insert(assets []models.Asset) ([]models.Asset, error)
- func (d *PostgresClient) InsertAssetAttributes(assetAttributes []models.AssetAttribute) ([]models.AssetAttribute, error)
- func (d *PostgresClient) InsertAttributes(attributes []models.Attribute) ([]models.Attribute, error)
- func (d *PostgresClient) List(deleted bool, pageSize, page int) ([]models.Asset, error)
- func (d *PostgresClient) ListAssetAttributeValues(assetID int64) (keyValues []models.KeyValue, err error)
- func (d *PostgresClient) ListAssetAttributes() (assetAttributes []models.AssetAttribute, err error)
- func (d *PostgresClient) ListAttributes() (attributes []models.Attribute, err error)
- func (d *PostgresClient) ListEvents() (events []models.Event, err error)
- func (d *PostgresClient) RecordEvent(content string) error
- func (d *PostgresClient) RestoreOne(asset_id int64) (models.Asset, error)
- func (d *PostgresClient) Seed() (sql.Result, error)
- func (d *PostgresClient) SelectAsset(id int64) (models.Asset, error)
- func (d *PostgresClient) UpdateAssetDescription(assetID int64, description string) (int64, string, error)
- func (d *PostgresClient) UpdateAssetStatus(assetID int64, status string) (int64, string, error)
- func (d *PostgresClient) UpdateAssetTarget(assetID, target int64) (int64, int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresClient ¶ added in v0.31.0
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
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) 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 (*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) SelectAsset ¶ added in v0.31.0
func (d *PostgresClient) SelectAsset(id int64) (models.Asset, error)
func (*PostgresClient) UpdateAssetDescription ¶ added in v0.31.0
func (*PostgresClient) UpdateAssetStatus ¶ added in v0.31.0
func (*PostgresClient) UpdateAssetTarget ¶ added in v0.31.0
func (d *PostgresClient) UpdateAssetTarget(assetID, target int64) (int64, int64, error)
Click to show internal directories.
Click to hide internal directories.