models

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseAssetPath  = "base_asset_path"
	UserAvatar     = "user_avatar"
	UserBackground = "user_background"

	ProductDescription = "product_description"
)
View Source
const (
	SupportClients = "support_clients"
	ClientUI       = "client_ui"
	ProjectUI      = "project_ui"
	Requires3D     = "requires_3d"
	HasTrial       = "has_trial"
	IsFree         = "is_free"
)
View Source
const (
	TwoStepsVerif = "two_steps_verif"
)

Variables

View Source
var DefaultImagePath = ""
View Source
var DefaultURL = ""
View Source
var ErrAssetRefNotInitialised = errors.New("Asset references not initialised")
View Source
var ErrInvalidAssetsID = "Invalid assets uuid"
View Source
var ErrInvalidSettingsID = "Invalid settings uuid"
View Source
var ErrProductDetailsNotInitialised = "Details map not initialised"
View Source
var ErrSettingNotInitialised = "Settings not initialised"
View Source
var NullUUID = uuid.MustParse("00000000-0000-0000-0000-000000000000")

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID      uuid.UUID `validation:"required"`
	DataMap DataMap   `validation:"required"`
}

func (*Asset) ClearAsset added in v0.0.7

func (r *Asset) ClearAsset(typeString string) error

func (*Asset) GetImagePath added in v0.0.7

func (r *Asset) GetImagePath(typeString string) string

func (*Asset) GetURL added in v0.0.7

func (r *Asset) GetURL(typeString string) string

func (*Asset) SetImagePath added in v0.0.7

func (r *Asset) SetImagePath(typeString string) error

func (*Asset) SetURL added in v0.0.7

func (r *Asset) SetURL(typeString string, url string)

type Data

type Data struct {
	ID       int     `json:"id"`
	DataType int     `json:"type"`
	Speed    float32 `json:"speed"`
}

type DataMap added in v0.0.7

type DataMap map[string]interface{}

Assets structure contains the identification of all user related documents images.

type Feature

type Feature struct {
	ID     int             `json:"id"`
	Name   string          `json:"name"`
	Config json.RawMessage `json:"config"`
}

Feature describes the available simulation features.

type InterfaceCommon added in v0.0.7

type InterfaceCommon interface {
	NewAsset(references DataMap, generatePath func(assetID *uuid.UUID) string) (*Asset, error)
	NewUser(
		name string,
		email string,
		password []byte,
		settingsID uuid.UUID,
		assetsID uuid.UUID) (*User, error)
	NewProduct(name string, public bool, detailsID *uuid.UUID, assetsID *uuid.UUID) (*Product, error)
}
var Interface InterfaceCommon

type Privilege

type Privilege struct {
	ID          int    `validation:"required"`
	Name        string `validation:"required"`
	Description string `validation:"required"`
}

type Privileges

type Privileges []Privilege

func (Privileges) IsOwnerPrivilege added in v0.0.7

func (l Privileges) IsOwnerPrivilege(privilege int) bool

func (Privileges) IsPartnerPrivilege added in v0.0.7

func (l Privileges) IsPartnerPrivilege(privilege int) bool

func (Privileges) IsValidPrivilege

func (l Privileges) IsValidPrivilege(privilege int) bool

type Product

type Product struct {
	ID        uuid.UUID `validation:"required"`
	Name      string    `validation:"required"`
	Public    bool
	AssetsID  uuid.UUID `validation:"required"`
	DetailsID uuid.UUID `validation:"required"`
}

type ProductUsers

type ProductUsers map[uuid.UUID]int

type Project

type Project struct {
	ID        uuid.UUID       `json:"id"`
	Name      string          `json:"name"`
	UserID    uuid.UUID       `json:"user_id"`
	FeatureID int             `json:"features_id"`
	Config    json.RawMessage `json:"config"`
}

Project defines the project structure.

type RepoInterface added in v0.0.7

type RepoInterface struct {
}

func (RepoInterface) NewAsset added in v0.0.7

func (RepoInterface) NewAsset(references DataMap, generatePath func(assetID *uuid.UUID) string) (*Asset, error)

func (RepoInterface) NewProduct added in v0.0.7

func (RepoInterface) NewProduct(name string, public bool, detailsID *uuid.UUID, assetsID *uuid.UUID) (*Product, error)

NewProduct creates a new product instance where details describe the configuration of the product and references contain all asset references.

func (RepoInterface) NewUser added in v0.0.7

func (RepoInterface) NewUser(
	name string,
	email string,
	password []byte,
	settingsID uuid.UUID,
	assetsID uuid.UUID) (*User, error)

type RepoUUIDInterface added in v0.0.7

type RepoUUIDInterface struct {
}

func (RepoUUIDInterface) NewUUID added in v0.0.7

func (RepoUUIDInterface) NewUUID() (uuid.UUID, error)

NewUUID is a wrapper to allow mocking

type UUIDImplMock added in v0.0.7

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

UUIDImplMock overwrites the default github uuid library implementation.

func (UUIDImplMock) NewUUID added in v0.0.7

func (i UUIDImplMock) NewUUID() (uuid.UUID, error)

type UUIDInterfaceCommon added in v0.0.7

type UUIDInterfaceCommon interface {
	NewUUID() (uuid.UUID, error)
}
var UUIDImpl UUIDInterfaceCommon

type User

type User struct {
	ID         uuid.UUID
	Name       string
	Email      string
	Password   []byte
	SettingsID uuid.UUID
	AssetsID   uuid.UUID
}

User defines the user structures. Each user must have an associated settings entry.

type UserProducts

type UserProducts struct {
	ProductMap     map[uuid.UUID]int
	ProductIDArray []uuid.UUID
}

Jump to

Keyboard shortcuts

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