teams

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package teams encapsulates reading/writing teams entities to Spanner.

Index

Constants

View Source
const (
	// TeamIDExpression is a partial regular expression that validates team identifiers.
	TeamIDExpression = `[0-9a-f]{32}`
)

Variables

View Source
var NotExistsErr error = errors.New("team was not found")

NotExistsErr is returned when the requested object was not found in the database.

Functions

func Create

func Create(team *Team) (*spanner.Mutation, error)

Create creates a team entry in the Spanner Database. Must be called with an active RW transaction in the context. CreateTime in the passed in team will be ignored in favour of the commit time.

func GenerateID

func GenerateID() (string, error)

GenerateID returns a random 128-bit team ID, encoded as 32 lowercase hexadecimal characters.

func Validate

func Validate(team *Team) error

Validate validates a team value.

Types

type Team

type Team struct {
	// Unique identifier of the team.
	ID string
	// Time the team was created.
	CreateTime time.Time
}

Team mirrors the structure of team values in the database.

func Read

func Read(ctx context.Context, ID string) (*Team, error)

Read retrieves a status update from the database given the exact time the status update was made.

type TeamBuilder

type TeamBuilder struct {
	// contains filtered or unexported fields
}

func NewTeamBuilder

func NewTeamBuilder() *TeamBuilder

func (*TeamBuilder) Build

func (b *TeamBuilder) Build() *Team

func (*TeamBuilder) CreateInDB

func (b *TeamBuilder) CreateInDB(ctx context.Context) (*Team, error)

func (*TeamBuilder) WithCreateTime

func (b *TeamBuilder) WithCreateTime(createTime time.Time) *TeamBuilder

func (*TeamBuilder) WithID

func (b *TeamBuilder) WithID(id string) *TeamBuilder

Jump to

Keyboard shortcuts

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