update to support postgresql and add godocs
Some checks failed
continuous-integration/drone Build is passing
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / End-to-End (push) Has been cancelled
CI / Publish Docker (push) Has been cancelled

This commit is contained in:
2026-01-13 17:05:14 +11:00
parent afec4aacb0
commit ea1eeb5c21
37 changed files with 618 additions and 38 deletions

35
db/querier.go Normal file
View File

@@ -0,0 +1,35 @@
package db
import (
"context"
"database/sql"
"vctp/db/queries"
)
// Querier abstracts sqlc-generated queries so multiple database backends can share call sites.
type Querier interface {
CleanupUpdates(ctx context.Context, arg queries.CleanupUpdatesParams) error
CleanupUpdatesNullVm(ctx context.Context) error
CreateEvent(ctx context.Context, arg queries.CreateEventParams) (queries.Events, error)
CreateInventory(ctx context.Context, arg queries.CreateInventoryParams) (queries.Inventory, error)
CreateInventoryHistory(ctx context.Context, arg queries.CreateInventoryHistoryParams) (queries.InventoryHistory, error)
CreateUpdate(ctx context.Context, arg queries.CreateUpdateParams) (queries.Updates, error)
GetInventoryByName(ctx context.Context, name string) ([]queries.Inventory, error)
GetInventoryByVcenter(ctx context.Context, vcenter string) ([]queries.Inventory, error)
GetInventoryEventId(ctx context.Context, cloudid sql.NullString) (queries.Inventory, error)
GetInventoryVcUrl(ctx context.Context, vc string) ([]queries.Inventory, error)
GetInventoryVmId(ctx context.Context, arg queries.GetInventoryVmIdParams) (queries.Inventory, error)
GetInventoryVmUuid(ctx context.Context, arg queries.GetInventoryVmUuidParams) (queries.Inventory, error)
GetReportInventory(ctx context.Context) ([]queries.Inventory, error)
GetReportUpdates(ctx context.Context) ([]queries.Updates, error)
GetVmUpdates(ctx context.Context, arg queries.GetVmUpdatesParams) ([]queries.Updates, error)
InventoryCleanup(ctx context.Context, arg queries.InventoryCleanupParams) error
InventoryCleanupTemplates(ctx context.Context) error
InventoryCleanupVcenter(ctx context.Context, vc string) error
InventoryMarkDeleted(ctx context.Context, arg queries.InventoryMarkDeletedParams) error
InventoryUpdate(ctx context.Context, arg queries.InventoryUpdateParams) error
ListEvents(ctx context.Context) ([]queries.Events, error)
ListInventory(ctx context.Context) ([]queries.Inventory, error)
ListUnprocessedEvents(ctx context.Context, eventtime sql.NullInt64) ([]queries.Events, error)
UpdateEventsProcessed(ctx context.Context, eid int64) error
}