storage

package
v0.0.0-...-33791c1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TablePartitionZoomLevel = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailsEntity

type DetailsEntity struct {
	Id              uint64 `db:"id"`
	Border          string `db:"border"`
	SimpleBorder    string `db:"simple_border"`
	SimpleBorderWKB []byte `db:"simple_border_wkb"`
	TileType        uint16 `db:"tiletype"`
	DateTime        int64  `db:"datetime"`
	Enabled         bool   `db:"enabled"`
	Identifier      string `db:"identifier"`
	Scale           uint16 `db:"scale"`
}

type Storage

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

func NewStorage

func NewStorage(dbName string) (*Storage, error)

func (*Storage) BeginTxx

func (s *Storage) BeginTxx() (*sqlx.Tx, error)

func (*Storage) Close

func (s *Storage) Close()

func (*Storage) CommitTxx

func (s *Storage) CommitTxx(txx *sqlx.Tx) error

func (*Storage) CreatePartitionTableIfNotExist

func (s *Storage) CreatePartitionTableIfNotExist(txx *sqlx.Tx, tableName string)

func (*Storage) GenerateTableName

func (s *Storage) GenerateTableName(key quadmap.QuadKey) string

GenerateTableName generates the table name that should be associated with the provided quadkey. Currently the assumption is that the table name will be associated with an ancestor of the quadkey at level 10. This is an attempt to find a sweet spot between performance and the number of tables. If the provided quadkey is already smaller than 10, then the table name will be "quadmap_high".

func (*Storage) GetAllDetails

func (s *Storage) GetAllDetails() ([]DetailsEntity, error)

func (*Storage) GetDetails

func (s *Storage) GetDetails(id int) (*DetailsEntity, error)

func (*Storage) GetTile

func (s *Storage) GetTile(qk quadmap.QuadKey) (*TileEntity, error)

func (*Storage) HasIdentifier

func (s *Storage) HasIdentifier(identifier string, tileType quadmap.TileType) bool

func (*Storage) InsertDetails

func (s *Storage) InsertDetails(details DetailsEntity) (int64, error)

func (*Storage) InsertIdentifier

func (s *Storage) InsertIdentifier(identifier string, tileType quadmap.TileType) error

func (*Storage) InsertTileWith

func (s *Storage) InsertTileWith(txx *sqlx.Tx, tile TileEntity) error

func (*Storage) InsertTileWithTableName

func (s *Storage) InsertTileWithTableName(txx *sqlx.Tx, tableName string, tile TileEntity) error

func (*Storage) SearchDetailsBetweenQuadKeys

func (s *Storage) SearchDetailsBetweenQuadKeys(qk1 quadmap.QuadKey, qk2 quadmap.QuadKey, tileTypes []quadmap.TileType, includeSimpleBorder bool, limit int) ([]DetailsEntity, error)

SearchDetailsWithinQuadKey returns details for any hits within a particular QuadKey

func (*Storage) SearchDetailsWithinQuadKey

func (s *Storage) SearchDetailsWithinQuadKey(qk quadmap.QuadKey, tileTypes []quadmap.TileType, includeSimpleBorder bool, limit int) ([]DetailsEntity, error)

func (*Storage) SearchQuadKeysWithinQuadKey

func (s *Storage) SearchQuadKeysWithinQuadKey(qk quadmap.QuadKey) ([]int64, error)

func (*Storage) UpdateDetails

func (s *Storage) UpdateDetails(details DetailsEntity) error

type TileEntity

type TileEntity struct {
	QuadKey     quadmap.QuadKey `db:"quadkey"`
	TileType    uint16          `db:"tiletype"`
	Full        bool            `db:"full"`
	DetailsMask uint64          `db:"details_mask"`
	DetailsID   int64           `db:"details_id"`
}

Entities: TileEntity has quadkey and details mask. The details mask will indicate if there are QuadKey is NOT the primary key... but will be indexed and will be main column we search on.

Jump to

Keyboard shortcuts

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