db

package
v0.0.0-...-3e6ee68 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArcFlag

type ArcFlag uint64

func (ArcFlag) IsSet

func (af ArcFlag) IsSet(id RegionId) bool

type CoordBounds

type CoordBounds struct {
	Latitude  MinMax
	Longitude MinMax
}

type DB

type DB interface {
	AddVertices(ctx context.Context, vertices []Vertex, generation Generation) error
	AddEdges(ctx context.Context, edges []Edge, generation Generation) error
	AddArcFlags(ctx context.Context, edgeIds []EdgeId, generation Generation) error

	GetVertexIds(ctx context.Context, id RegionId, generation Generation) ([]VertexId, error)
	GetEdgesFrom(ctx context.Context, from []VertexId, generation Generation) (map[VertexId][]Edge, error)
	GetArcFlags(ctx context.Context, edgeIds []EdgeId, generation Generation) ([]ArcFlag, error)
	GetVertexCount(ctx context.Context, coordsBetween CoordBounds, generation Generation) (int64, error)
	GetVertexCountOnVerticalSegment(ctx context.Context, latitude MinMax, longtitude float64, generation Generation) (int64, error)
	GetVertexCountOnHorizontalSegment(ctx context.Context, latitude float64, longtitude MinMax, generation Generation) (int64, error)
	GetVertexRegion(ctx context.Context, id VertexId, generation Generation) (RegionId, error)
	GetEdgeToRegionMapping(ctx context.Context, regionId RegionId, generation Generation) (map[EdgeId]RegionId, error)
	GetCurrentGeneration(ctx context.Context) (Generation, error)
	GetNextGeneration(ctx context.Context) (Generation, error)
	GetActiveGeneration(ctx context.Context) (Generation, error)

	SetFlag(ctx context.Context, edgeIds []EdgeId, region RegionId, generation Generation) error
	SetRegion(ctx context.Context, coordsBetween CoordBounds, region RegionId, generation Generation) (rowsAffected int64, err error)
	SetCurrentGeneration(ctx context.Context, generation Generation) error
	SetNextGeneration(ctx context.Context, generation Generation) error
	SetActiveGeneration(ctx context.Context, generation Generation) error
}

func Connect

func Connect(con *gorm.DB) (DB, error)

func ConnectToDefault

func ConnectToDefault() (DB, error)

type Edge

type Edge = api.Edge

type EdgeId

type EdgeId = api.EdgeId

type Generation

type Generation = api.Generation

type MinMax

type MinMax struct {
	Min float64 // Inclusive
	Max float64 // Exclusive
}

type RegionId

type RegionId = uint16

type Vertex

type Vertex = api.Vertex

type VertexId

type VertexId = api.VertexId

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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