model

package
v0.0.0-...-0ba4654 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// limit vector dimension
	AP_LIMIT = 4
)

Variables

This section is empty.

Functions

func InitDB

func InitDB(logw logger.Writer)

InitDB before you call any method about data model.

func MapExist

func MapExist(mapID uint) (bool, error)

MapExist use count() to check if the map exist.

if count > 0, return true, if error, return false and error.

Types

type APVector

type APVector struct {
	gorm.Model
	MapID          uint `gorm:"map_id"`
	I0, I1, I2, I3 int64
	LocX, LocY     float64
}

func GetVecByMap

func GetVecByMap(m *LocationMap) (vecList []APVector, err error)

func (APVector) Add

func (v APVector) Add() error

Add the vector of map into DB

func (APVector) GetLocation

func (v APVector) GetLocation() (float64, float64)

func (APVector) GetVecVal

func (v APVector) GetVecVal(i int) int64

implement algo.APVector methods

func (APVector) TableName

func (APVector) TableName() string

type LocationMap

type LocationMap struct {
	gorm.Model
	Name   string
	Path   string `gorm:"comment:地图图像存储的路径"`
	Width  int64  `gorm:"comment:地图宽度"`
	Height int64  `gorm:"comment:地图高度"`
}

func GetAllMap

func GetAllMap() (maps []*LocationMap, err error)

GetAllMap return all location map in DB

func GetMap

func GetMap(mapID uint) (*LocationMap, error)

GetMap return the map info of mapID in DB,

if map not existed, return map will be nil.

func (LocationMap) Add

func (m LocationMap) Add() error

Add the map into DB

Jump to

Keyboard shortcuts

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