Documentation ¶
Overview ¶
Package status manages status values.
Index ¶
Constants ¶
const ( // TreeNameExpression is a partial regular expression that validates tree identifiers. TreeNameExpression = `[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?` // StatusIDExpression is a partial regular expression that validates status identifiers. StatusIDExpression = `[0-9a-f]{32}` )
Variables ¶
var NotExistsErr error = errors.New("status value was not found")
NotExistsErr is returned when the requested object was not found in the database.
Functions ¶
func ClearStatusUsers ¶
ClearStatusUsers clears the column CreateUser in table Status.
The retention policy is 63 days, but we delete it at 30 days to allow time to fix issues with the deletion process, as well as allow time for data to be wiped from the underlying storage media.
func Create ¶
Create creates a status entry in the Spanner Database. Must be called with an active RW transaction in the context. CreateUser and CreateTime in the passed in status will be ignored in favour of the commit time and the currentUser argument.
func GenerateID ¶
GenerateID returns a random 128-bit status ID, encoded as 32 lowercase hexadecimal characters.
Types ¶
type ListOptions ¶
type ListOptions struct { // The offset into the list of statuses in the database to start reading at. Offset int64 // The maximum number of items to return from the database. // If left as 0, the value of 100 will be used. Limit int64 }
ListOptions allows specifying extra options to the List method.
type Status ¶
type Status struct { // The name of the tree this status is part of. TreeName string // The unique identifier for the status. This is a randomly generated // 128-bit ID, encoded as 32 lowercase hexadecimal characters. StatusID string // The general state of the tree. GeneralStatus pb.GeneralState // The message explaining details about the status. Message string // The username of the user who added this. Will be // set to 'user' after the username TTL (of 30 days). CreateUser string // The time the status update was made. // If filling this in from commit timestamp, make sure to call .UTC(), i.e. // status.CreateTime = timestamp.UTC() CreateTime time.Time }
Status mirrors the structure of status values in the database.
func List ¶
List retrieves a list of status values from the database. Status values are listed in reverse CreateTime order (i.e. most recently created first). The options argument may be nil to use default options.