mongodoc

package
v0.0.0-...-55990d1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatasetSchemas

func NewDatasetSchemas(datasetSchemas []*dataset.Schema, f scene.IDList) ([]interface{}, []string)

func NewDatasets

func NewDatasets(datasets []*dataset.Dataset, f scene.IDList) ([]interface{}, []string)

func NewLayers

func NewLayers(layers layer.List, f scene.IDList) ([]interface{}, []string)

func NewNLSLayerConfig

func NewNLSLayerConfig(c map[string]any) *nlslayer.Config

func NewNLSLayerGeometry

func NewNLSLayerGeometry(g nlslayer.Geometry) map[string]any

func NewNLSLayerType

func NewNLSLayerType(p string) nlslayer.LayerType

func NewNLSLayers

func NewNLSLayers(layers nlslayer.NLSLayerList, f scene.IDList) ([]interface{}, []string)

func NewProperties

func NewProperties(properties []*property.Property, f scene.IDList) ([]interface{}, []string)

func NewPropertySchemas

func NewPropertySchemas(ps []*property.Schema, f scene.IDList) ([]interface{}, []string)

func NewStorytellings

func NewStorytellings(sl *storytelling.StoryList) ([]any, []string)

func NewStyleValue

func NewStyleValue(c map[string]any) *scene.StyleValue

func NewStyles

func NewStyles(styles scene.StyleList, f scene.IDList) ([]interface{}, []string)

func NewTags

func NewTags(tags []*tag.Tag, f scene.IDList) ([]interface{}, []string)

func ToModelInfobox

func ToModelInfobox(ib *LayerInfoboxDocument) (*layer.Infobox, error)

func ToModelNLSInfobox

func ToModelNLSInfobox(ib *NLSLayerInfoboxDocument) (*nlslayer.Infobox, error)

func ToModelNLSLayerGeometry

func ToModelNLSLayerGeometry(g map[string]any) (nlslayer.Geometry, error)

func ToModelNLSLayerSketchInfo

func ToModelNLSLayerSketchInfo(si *NLSLayerSketchInfoDocument) (*nlslayer.SketchInfo, error)

Types

type AssetConsumer

type AssetConsumer = Consumer[*AssetDocument, *asset.Asset]

func NewAssetConsumer

func NewAssetConsumer(workspaces []accountdomain.WorkspaceID) *AssetConsumer

type AssetDocument

type AssetDocument struct {
	ID          string
	CreatedAt   time.Time
	Team        string // DON'T CHANGE NAME'
	Name        string
	Size        int64
	URL         string
	ContentType string
}

func NewAsset

func NewAsset(asset *asset.Asset) (*AssetDocument, string)

func (*AssetDocument) Model

func (d *AssetDocument) Model() (*asset.Asset, error)

type Auth

type Auth struct {
	Cert string
	Key  string
}

func NewConfigAuth

func NewConfigAuth(c *config.Auth) *Auth

type BlockDocument

type BlockDocument struct {
	Id        string
	Plugin    string
	Extension string
	Property  string
}

func (BlockDocument) Model

func (d BlockDocument) Model() (*storytelling.Block, error)

type ConfigDocument

type ConfigDocument struct {
	Migration     int64
	Auth          *Auth
	DefaultPolicy *policy.ID
}

func NewConfig

func NewConfig(c config.Config) ConfigDocument

func (*ConfigDocument) Model

func (c *ConfigDocument) Model() *config.Config

type Consumer

type Consumer[T, K any] struct {
	Result []K
	// contains filtered or unexported fields
}

func NewConsumer

func NewConsumer[T Model[U], U any](filter func(U) bool) *Consumer[T, U]

func (*Consumer[T, K]) Consume

func (s *Consumer[T, K]) Consume(raw bson.Raw) error

type DatasetBatchConsumer

type DatasetBatchConsumer struct {
	Size     int
	Callback func([]*dataset.Dataset) error
	// contains filtered or unexported fields
}

func (*DatasetBatchConsumer) Consume

func (c *DatasetBatchConsumer) Consume(raw bson.Raw) error

type DatasetConsumer

type DatasetConsumer = Consumer[*DatasetDocument, *dataset.Dataset]

func NewDatasetConsumer

func NewDatasetConsumer(scenes []id.SceneID) *DatasetConsumer

type DatasetDocument

type DatasetDocument struct {
	ID     string
	Source string
	Schema string
	Fields []*DatasetFieldDocument
	Scene  string
}

func NewDataset

func NewDataset(dataset *dataset.Dataset) (*DatasetDocument, string)

func (*DatasetDocument) Model

func (doc *DatasetDocument) Model() (*dataset.Dataset, error)

type DatasetExtendedDocument

type DatasetExtendedDocument struct {
	DatasetDocument
	Graph []*DatasetExtendedDocument
	Depth int
}

type DatasetFieldDocument

type DatasetFieldDocument struct {
	Field  string
	Type   string
	Value  interface{}
	Source string
}

type DatasetMapConsumer

type DatasetMapConsumer struct {
	Map dataset.Map
}

func (*DatasetMapConsumer) Consume

func (c *DatasetMapConsumer) Consume(raw bson.Raw) error

type DatasetSchemaConsumer

type DatasetSchemaConsumer = Consumer[*DatasetSchemaDocument, *dataset.Schema]

func NewDatasetSchemaConsumer

func NewDatasetSchemaConsumer(scenes []id.SceneID) *DatasetSchemaConsumer

type DatasetSchemaDocument

type DatasetSchemaDocument struct {
	ID                  string
	Source              string
	Name                string
	Fields              []*DatasetSchemaFieldDocument
	RepresentativeField *string
	Scene               string
}

func NewDatasetSchema

func NewDatasetSchema(dataset *dataset.Schema) (*DatasetSchemaDocument, string)

func (*DatasetSchemaDocument) Model

func (d *DatasetSchemaDocument) Model() (*dataset.Schema, error)

type DatasetSchemaFieldDocument

type DatasetSchemaFieldDocument struct {
	ID     string
	Name   string
	Type   string
	Source string
}

type LayerConsumer

type LayerConsumer = Consumer[*LayerDocument, layer.Layer]

func NewLayerConsumer

func NewLayerConsumer(scenes []id.SceneID) *LayerConsumer

type LayerDocument

type LayerDocument struct {
	ID        string
	Name      string
	Visible   bool
	Scene     string
	Plugin    *string
	Extension *string
	Property  *string
	Infobox   *LayerInfoboxDocument
	Item      *LayerItemDocument
	Group     *LayerGroupDocument
	Tags      LayerTagListDocument
}

func NewLayer

func NewLayer(l layer.Layer) (*LayerDocument, string)

func (*LayerDocument) Model

func (d *LayerDocument) Model() (layer.Layer, error)

func (*LayerDocument) ModelGroup

func (d *LayerDocument) ModelGroup() (*layer.Group, error)

func (*LayerDocument) ModelItem

func (d *LayerDocument) ModelItem() (*layer.Item, error)

type LayerGroupDocument

type LayerGroupDocument struct {
	Layers              []string
	LinkedDatasetSchema *string
	Root                bool
}

type LayerInfoboxDocument

type LayerInfoboxDocument struct {
	Property string
	Fields   []LayerInfoboxFieldDocument
}

type LayerInfoboxFieldDocument

type LayerInfoboxFieldDocument struct {
	ID        string
	Plugin    string
	Extension string
	Property  string
}

type LayerItemDocument

type LayerItemDocument struct {
	LinkedDataset *string
}

type LayerTagDocument

type LayerTagDocument struct {
	ID    string
	Group bool
	Tags  []LayerTagDocument
}

func NewLayerTag

func NewLayerTag(t layer.Tag) *LayerTagDocument

func (*LayerTagDocument) Model

func (d *LayerTagDocument) Model() layer.Tag

type LayerTagListDocument

type LayerTagListDocument []LayerTagDocument

func NewLayerTagList

func NewLayerTagList(list *layer.TagList) LayerTagListDocument

func (*LayerTagListDocument) Model

func (d *LayerTagListDocument) Model() *layer.TagList

type Model

type Model[T any] interface {
	Model() (T, error)
}

type NLSLayerConsumer

type NLSLayerConsumer = Consumer[*NLSLayerDocument, nlslayer.NLSLayer]

func NewNLSLayerConsumer

func NewNLSLayerConsumer(scenes []id.SceneID) *NLSLayerConsumer

type NLSLayerDocument

type NLSLayerDocument struct {
	ID        string
	Title     string
	Visible   bool
	Scene     string
	LayerType string
	Infobox   *NLSLayerInfoboxDocument
	Simple    *NLSLayerSimpleDocument
	Group     *NLSLayerGroupDocument
	IsSketch  bool
	Sketch    *NLSLayerSketchInfoDocument
}

func NewNLSLayer

func NewNLSLayer(l nlslayer.NLSLayer) (*NLSLayerDocument, string)

func (*NLSLayerDocument) Model

func (d *NLSLayerDocument) Model() (nlslayer.NLSLayer, error)

func (*NLSLayerDocument) ModelGroup

func (d *NLSLayerDocument) ModelGroup() (*nlslayer.NLSLayerGroup, error)

func (*NLSLayerDocument) ModelSimple

func (d *NLSLayerDocument) ModelSimple() (*nlslayer.NLSLayerSimple, error)

type NLSLayerFeatureCollectionDocument

type NLSLayerFeatureCollectionDocument struct {
	Type     string
	Features []NLSLayerFeatureDocument
}

type NLSLayerFeatureDocument

type NLSLayerFeatureDocument struct {
	ID         string
	Type       string
	Geometry   map[string]any
	Properties map[string]any
}

type NLSLayerGeometryCollectionDocument

type NLSLayerGeometryCollectionDocument struct {
	Type       string
	Geometries []map[string]any
}

type NLSLayerGeometryDocument

type NLSLayerGeometryDocument interface{}

type NLSLayerGroupDocument

type NLSLayerGroupDocument struct {
	Children []string
	Root     bool
	Config   map[string]any
}

type NLSLayerInfoboxBlockDocument

type NLSLayerInfoboxBlockDocument struct {
	ID        string
	Property  string
	Plugin    string
	Extension string
}

type NLSLayerInfoboxDocument

type NLSLayerInfoboxDocument struct {
	Property string
	Blocks   []NLSLayerInfoboxBlockDocument
}

func NewNLSInfobox

func NewNLSInfobox(ib *nlslayer.Infobox) *NLSLayerInfoboxDocument

type NLSLayerLineString

type NLSLayerLineString struct {
	Type        string
	Coordinates [][]float64
}

type NLSLayerMultiPolygonDocument

type NLSLayerMultiPolygonDocument struct {
	Type        string
	Coordinates [][][][]float64
}

type NLSLayerPointDocument

type NLSLayerPointDocument struct {
	Type        string
	Coordinates []float64
}

type NLSLayerPolygonDocument

type NLSLayerPolygonDocument struct {
	Type        string
	Coordinates [][][]float64
}

type NLSLayerSimpleDocument

type NLSLayerSimpleDocument struct {
	Config map[string]any
}

type NLSLayerSketchInfoDocument

type NLSLayerSketchInfoDocument struct {
	CustomPropertySchema *map[string]any
	FeatureCollection    *NLSLayerFeatureCollectionDocument
}

type PageDocument

type PageDocument struct {
	Id          string
	Property    string
	Title       string
	Swipeable   bool
	Layers      []string
	SwipeLayers []string
	Blocks      []BlockDocument
}

func (*PageDocument) Model

func (d *PageDocument) Model() (*storytelling.Page, error)

type PluginConsumer

type PluginConsumer = Consumer[*PluginDocument, *plugin.Plugin]

func NewPluginConsumer

func NewPluginConsumer(scenes []id.SceneID) *PluginConsumer

type PluginDocument

type PluginDocument struct {
	ID            string
	Name          map[string]string
	Author        string
	Description   map[string]string
	RepositoryURL string
	Extensions    []PluginExtensionDocument
	Schema        *string
	Scene         *string `bson:",omitempty"`
}

func NewPlugin

func NewPlugin(plugin *plugin.Plugin) (*PluginDocument, string)

func (*PluginDocument) Model

func (d *PluginDocument) Model() (*plugin.Plugin, error)

type PluginExtensionDocument

type PluginExtensionDocument struct {
	ID           string
	Type         string
	Name         map[string]string
	Description  map[string]string
	Icon         string
	Schema       string
	Visualizer   string `bson:",omitempty"`
	SingleOnly   bool
	WidgetLayout *WidgetLayoutDocument
}

type PolicyConsumer

func NewPolicyConsumer

func NewPolicyConsumer() *PolicyConsumer

type PolicyDocument

type PolicyDocument struct {
	ID                    policy.ID
	Name                  string `bson:"name,omitempty"`
	ProjectCount          *int
	PublishedProjectCount *int
	MemberCount           *int
	LayerCount            *int
	DatasetCount          *int
	DatasetSchemaCount    *int
	AssetStorageSize      *int64
}

func (PolicyDocument) Model

func (d PolicyDocument) Model() *policy.Policy

type ProjectConsumer

type ProjectConsumer = Consumer[*ProjectDocument, *project.Project]

func NewProjectConsumer

func NewProjectConsumer(workspaces []accountdomain.WorkspaceID) *ProjectConsumer

type ProjectDocument

type ProjectDocument struct {
	ID                string
	Archived          bool
	IsBasicAuthActive bool
	BasicAuthUsername string
	BasicAuthPassword string
	UpdatedAt         time.Time
	PublishedAt       time.Time
	Name              string
	Description       string
	Alias             string
	ImageURL          string
	PublicTitle       string
	PublicDescription string
	PublicImage       string
	PublicNoIndex     bool
	Team              string // DON'T CHANGE NAME'
	Visualizer        string
	PublishmentStatus string
	CoreSupport       bool
	EnableGA          bool
	TrackingID        string
}

func NewProject

func NewProject(project *project.Project) (*ProjectDocument, string)

func (*ProjectDocument) Model

func (d *ProjectDocument) Model() (*project.Project, error)

type PropertyBatchConsumer

type PropertyBatchConsumer struct {
	Size     int
	Callback func([]*property.Property) error
	// contains filtered or unexported fields
}

func (*PropertyBatchConsumer) Consume

func (c *PropertyBatchConsumer) Consume(raw bson.Raw) error

type PropertyConditonDocument

type PropertyConditonDocument struct {
	Field string
	Type  string
	Value interface{}
}

type PropertyConsumer

type PropertyConsumer = Consumer[*PropertyDocument, *property.Property]

func NewPropertyConsumer

func NewPropertyConsumer(scenes []id.SceneID) *PropertyConsumer

type PropertyDocument

type PropertyDocument struct {
	ID           string
	Scene        string
	Schema       string `bson:",omitempty"` // compatibility
	SchemaPlugin string
	SchemaName   string
	Items        []*PropertyItemDocument
}

func NewProperty

func NewProperty(property *property.Property) (*PropertyDocument, string)

func (*PropertyDocument) Model

func (doc *PropertyDocument) Model() (*property.Property, error)

type PropertyFieldDocument

type PropertyFieldDocument struct {
	Field string
	Type  string
	Links []*PropertyLinkDocument
	Value interface{}
}

type PropertyItemDocument

type PropertyItemDocument struct {
	Type        string
	ID          string
	SchemaGroup string
	Groups      []*PropertyItemDocument
	Fields      []*PropertyFieldDocument
}

type PropertyLinkDocument

type PropertyLinkDocument struct {
	Schema  *string
	Dataset *string
	Field   *string
}

type PropertySchemaConsumer

type PropertySchemaConsumer = Consumer[*PropertySchemaDocument, *property.Schema]

func NewPropertySchemaConsumer

func NewPropertySchemaConsumer(scenes []id.SceneID) *PropertySchemaConsumer

type PropertySchemaDocument

type PropertySchemaDocument struct {
	ID             string
	Scene          *string `bson:",omitempty"`
	Version        int
	Groups         []*PropertySchemaGroupDocument
	LinkableFields *PropertyLinkableFieldsDocument
}

func NewPropertySchema

func NewPropertySchema(m *property.Schema) (*PropertySchemaDocument, string)

func (*PropertySchemaDocument) Model

func (doc *PropertySchemaDocument) Model() (*property.Schema, error)

type PropertySchemaFieldChoiceDocument

type PropertySchemaFieldChoiceDocument struct {
	Key   string
	Label map[string]string
}

type PropertySchemaFieldDocument

type PropertySchemaFieldDocument struct {
	ID            string
	Type          string
	Name          map[string]string
	Description   map[string]string
	Prefix        string
	Suffix        string
	DefaultValue  interface{}
	UI            *string
	Min           *float64
	Max           *float64
	Choices       []PropertySchemaFieldChoiceDocument
	IsAvailableIf *PropertyConditonDocument `bson:",omitempty"`
}

type PropertySchemaFieldPointerDocument

type PropertySchemaFieldPointerDocument struct {
	SchemaGroupID string
	FieldID       string
}

type PropertySchemaGroupDocument

type PropertySchemaGroupDocument struct {
	ID                    string
	Fields                []*PropertySchemaFieldDocument
	List                  bool
	IsAvailableIf         *PropertyConditonDocument
	Title                 map[string]string
	RepresentativeFieldID *string `bson:",omitempty"`
}

func (*PropertySchemaGroupDocument) Model

type SceneClusterDocument

type SceneClusterDocument struct {
	ID       string
	Name     string
	Property string
}

type SceneConsumer

type SceneConsumer = Consumer[*SceneDocument, *scene.Scene]

func NewSceneConsumer

func NewSceneConsumer(workspaces []accountdomain.WorkspaceID) *SceneConsumer

type SceneDocument

type SceneDocument struct {
	ID          string
	Project     string
	Team        string // DON'T CHANGE NAME'
	RootLayer   string
	Widgets     []SceneWidgetDocument
	AlignSystem *WidgetAlignSystemDocument
	Plugins     []ScenePluginDocument
	UpdateAt    time.Time
	Property    string
	Clusters    []SceneClusterDocument
}

func NewScene

func NewScene(scene *scene.Scene) (*SceneDocument, string)

func (*SceneDocument) Model

func (d *SceneDocument) Model() (*scene.Scene, error)

type SceneIDConsumer

type SceneIDConsumer struct {
	Rows []id.SceneID
}

func (*SceneIDConsumer) Consume

func (c *SceneIDConsumer) Consume(raw bson.Raw) error

type SceneIDDocument

type SceneIDDocument struct {
	ID string
}

type SceneLockConsumer

type SceneLockConsumer struct {
	Rows []scene.LockMode
}

func (*SceneLockConsumer) Consume

func (c *SceneLockConsumer) Consume(raw bson.Raw) error

type SceneLockDocument

type SceneLockDocument struct {
	Scene string
	Lock  string
}

func NewSceneLock

func NewSceneLock(sceneID id.SceneID, lock scene.LockMode) *SceneLockDocument

func (*SceneLockDocument) Model

type ScenePluginDocument

type ScenePluginDocument struct {
	Plugin   string
	Property *string
}

type SceneWidgetDocument

type SceneWidgetDocument struct {
	ID        string
	Plugin    string
	Extension string
	Property  string
	Enabled   bool
	Extended  bool
}

type StorytellingConsumer

type StorytellingConsumer = Consumer[*StorytellingDocument, *storytelling.Story]

func NewStorytellingConsumer

func NewStorytellingConsumer(scenes []id.SceneID) *StorytellingConsumer

type StorytellingDocument

type StorytellingDocument struct {
	Id            string
	Property      string
	Scene         string
	Title         string
	Alias         string
	Pages         []PageDocument
	Status        string
	PublishedAt   *time.Time
	UpdatedAt     time.Time
	Index         int
	PanelPosition string
	BgColor       string

	IsBasicAuthActive bool
	BasicAuthUsername string
	BasicAuthPassword string
	PublicTitle       string
	PublicDescription string
	PublicImage       string
	PublicNoIndex     bool
}

func NewStorytelling

func NewStorytelling(s *storytelling.Story) (*StorytellingDocument, string)

func (*StorytellingDocument) Model

type StyleConsumer

type StyleConsumer = Consumer[*StyleDocument, *scene.Style]

func NewStyleConsumer

func NewStyleConsumer(scenes []id.SceneID) *StyleConsumer

type StyleDocument

type StyleDocument struct {
	ID    string
	Name  string
	Value map[string]any
	Scene string
}

func NewStyle

func NewStyle(s scene.Style) (*StyleDocument, string)

func (*StyleDocument) Model

func (d *StyleDocument) Model() (*scene.Style, error)

type TagConsumer

type TagConsumer = Consumer[*TagDocument, tag.Tag]

func NewTagConsumer

func NewTagConsumer(scenes []id.SceneID) *TagConsumer

type TagDocument

type TagDocument struct {
	ID    string
	Label string
	Scene string
	Item  *TagItemDocument
	Group *TagGroupDocument
}

func NewTag

func NewTag(t tag.Tag) (*TagDocument, string)

func (*TagDocument) Model

func (d *TagDocument) Model() (tag.Tag, error)

func (*TagDocument) ModelGroup

func (d *TagDocument) ModelGroup() (*tag.Group, error)

func (*TagDocument) ModelItem

func (d *TagDocument) ModelItem() (*tag.Item, error)

type TagGroupDocument

type TagGroupDocument struct {
	Tags []string
}

type TagItemDocument

type TagItemDocument struct {
	Parent                *string
	LinkedDatasetFieldID  *string
	LinkedDatasetID       *string
	LinkedDatasetSchemaID *string
}

type WidgetAlignSystemDocument

type WidgetAlignSystemDocument struct {
	Inner *WidgetZoneDocument
	Outer *WidgetZoneDocument
}

func (*WidgetAlignSystemDocument) Model

type WidgetAreaDocument

type WidgetAreaDocument struct {
	WidgetIDs  []string
	Align      string
	Padding    *WidgetAreaPaddingDocument
	Gap        *int
	Centered   bool
	Background *string
}

func NewWidgetArea

func NewWidgetArea(a *scene.WidgetArea) *WidgetAreaDocument

func (*WidgetAreaDocument) Model

func (a *WidgetAreaDocument) Model() *scene.WidgetArea

type WidgetAreaPaddingDocument

type WidgetAreaPaddingDocument struct {
	Top, Bottom, Left, Right int
}

func (*WidgetAreaPaddingDocument) Model

type WidgetExtendableDocument

type WidgetExtendableDocument struct {
	Vertically   bool
	Horizontally bool
}

type WidgetLayoutDocument

type WidgetLayoutDocument struct {
	Extendable      *WidgetExtendableDocument
	Extended        bool
	Floating        bool
	DefaultLocation *WidgetLocationDocument
}

func NewWidgetLayout

func NewWidgetLayout(l *plugin.WidgetLayout) *WidgetLayoutDocument

func (*WidgetLayoutDocument) Model

type WidgetLocationDocument

type WidgetLocationDocument struct {
	Zone    string
	Section string
	Area    string
}

func (*WidgetLocationDocument) Model

type WidgetSectionDocument

type WidgetSectionDocument struct {
	Top    *WidgetAreaDocument
	Middle *WidgetAreaDocument
	Bottom *WidgetAreaDocument
}

func NewWidgetSection

func NewWidgetSection(s *scene.WidgetSection) *WidgetSectionDocument

func (*WidgetSectionDocument) Model

type WidgetZoneDocument

type WidgetZoneDocument struct {
	Left   *WidgetSectionDocument
	Center *WidgetSectionDocument
	Right  *WidgetSectionDocument
}

func NewWidgetZone

func NewWidgetZone(z *scene.WidgetZone) *WidgetZoneDocument

func (*WidgetZoneDocument) Model

func (d *WidgetZoneDocument) Model() *scene.WidgetZone

Jump to

Keyboard shortcuts

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