Documentation
¶
Overview ¶
Package cloudsql implements the interface to interact with the Cloud SQL API.
Index ¶
Constants ¶
const InsertBuildsTemplate = "" /* 177-byte string literal not displayed */
InsertBuildsTemplate is the constant string template for how we will insert builds into the Cloud SQL PSQL database. The table name will need to be provided. "ON CONFLICT DO NOTHING" is added so that in the case of a duplicated build being inserted neither an error is returned nor, rows updated.
const SelectBuildsTemplate = `` /* 348-byte string literal not displayed */
SelectBuildsTemplate will be used as the basis to fetch the required builds for timed Event configs. The table name and where clause items will need to be provided.
NOTE: The rank function here creates groupings of ("build_target", "milestone") pairs and gives the newest a value of rank 1. Using this we can ignore all but the latest image for the given build_target and milestone.
const SelectWhereClauseItem = "(\"build_target\" = '%s' AND \"milestone\" = %d)"
Variables ¶
This section is empty.
Functions ¶
func ConvertPSQLRowToBuild ¶
func ConvertPSQLRowToBuild(Row *PSQLBuildRow) *kronpb.Build
ConvertPSQLRowToBuild converts a PSQLBuildRow into a kronpb.Build type.
func RowToSlice ¶
func RowToSlice(row *PSQLBuildRow) []any
RowToSlice converts the row type to a slice of field pointers. This is required when passing to the generic variadic functions for sql insertion.
func ScanBuildRows ¶
ScanBuildRows handles row scans when querying build rows.
Types ¶
type Client ¶
type PSQLBuildRow ¶
type PSQLBuildRow struct { BuildUUID string RunUUID string CreateTime pgtype.Timestamptz Bbid int64 BuildTarget string Milestone int64 Version string ImagePath string Board string Variant string }
PSQLBuildRow is a PSQL compliant version of the kronpb.Build type. The difference here is that for the PSQL adapter we need to use pgtype.Timestamptz for timestamps rather than timestamppb.Timestamp.
func ConvertBuildToPSQLRow ¶
func ConvertBuildToPSQLRow(build *kronpb.Build) (*PSQLBuildRow, error)
ConvertBuildToPSQLRow converts a kronpb.Build into a PSQLBuildRow type.