Documentation
¶
Index ¶
- Variables
- type Account
- type AccountConfig
- type AccountsRepository
- type AttributeSettings
- type Authentication
- type ByteSize
- type FieldsConfig
- type FileInfo
- type FilesChanges
- type FilesReader
- type Flags
- type Geocoding
- type GroupSettings
- type GroupTreeNode
- type LayerAttribute
- type LayerMeta
- type LayerNode
- type LayerPermission
- type LayerSettings
- type LayerTreeNode
- type Object
- type ParamValue
- type Profile
- type Project
- type ProjectFile
- type ProjectFileInfo
- type ProjectInfo
- type ProjectRole
- type ProjectSettings
- type Projection
- type ProjectsRepository
- type QgisMeta
- type QueryParams
- type RolePermissions
- type ScriptModule
- type Scripts
- type SearchQueryParam
- type SettingsAuthentication
- type StringArray
- type Topic
- type TreeNode
- type User
- type UserRolesPermissions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAccountExists = errors.New("Account already exists") ErrAccountActive = errors.New("Account was already activated") ErrAccountNotFound = errors.New("Account not found") )
View Source
var ( ErrProjectNotExists = errors.New("project does not exists") ErrFileNotExists = errors.New("project file does not exists") ErrProjectAlreadyExists = errors.New("project already exists") )
View Source
var (
ErrInvalidQgisMeta = errors.New("invalid qgis meta data")
)
View Source
var ErrInvalidTree = errors.New("Invalid tree structure")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
Username string
Email string
Password []byte
FirstName string
LastName string
Superuser bool
Active bool
Created *time.Time
Confirmed *time.Time
LastLogin *time.Time
Profile Profile
}
Account entity
func NewAccount ¶
func (*Account) CheckPassword ¶
func (*Account) SetPassword ¶
type AccountConfig ¶
type AccountConfig struct {
ProjectsCountLimit int `json:"projects_limit"`
ProjectSizeLimit ByteSize `json:"project_size_limit"`
StorageLimit ByteSize `json:"storage_limit"`
}
func (*AccountConfig) CheckProjectSizeLimit ¶
func (c *AccountConfig) CheckProjectSizeLimit(size int64) bool
func (*AccountConfig) CheckProjectsLimit ¶
func (c *AccountConfig) CheckProjectsLimit(count int) bool
func (*AccountConfig) CheckStorageLimit ¶
func (c *AccountConfig) CheckStorageLimit(size int64) bool
func (*AccountConfig) HasProjectSizeLimit ¶
func (c *AccountConfig) HasProjectSizeLimit() bool
func (*AccountConfig) HasStorageLimit ¶
func (c *AccountConfig) HasStorageLimit() bool
type AccountsRepository ¶
type AccountsRepository interface {
Create(account Account) error
Update(account Account) error
UpdateProfile(account Account) error
UpdateProfile2(username string, profile Profile) error
Delete(username string) error
GetByUsername(username string) (Account, error)
GetByEmail(email string) (Account, error)
EmailExists(email string) (bool, error)
UsernameExists(username string) (bool, error)
GetAllAccounts() ([]Account, error)
GetActiveAccounts() ([]Account, error)
}
AccountsRepository repository interface
type AttributeSettings ¶
type Authentication ¶
type Authentication struct {
Type string `json:"type"`
Users []string `json:"users,omitempty"`
Roles []ProjectRole `json:"roles,omitempty"`
}
type ByteSize ¶
type ByteSize int64
func (*ByteSize) UnmarshalJSON ¶
type FieldsConfig ¶
type FieldsConfig struct {
Global StringArray `json:"global,omitempty"`
Infopanel StringArray `json:"infopanel,omitempty"`
Table StringArray `json:"table,omitempty"`
}
type FilesChanges ¶
type FilesChanges struct {
Removes []string
Updates []ProjectFile
}
type FilesReader ¶
type FilesReader func() (string, io.ReadCloser, error)
type Geocoding ¶
type Geocoding struct {
Service string `json:"service,omitempty"`
URL string `json:"url,omitempty"`
QueryParams []SearchQueryParam `json:"query_params,omitempty"`
}
type GroupSettings ¶
type GroupTreeNode ¶
type GroupTreeNode struct {
Name string `json:"name"`
WmsName string `json:"wms_name,omitempty"`
Layers []TreeNode `json:"layers"`
MutuallyExclusive bool `json:"mutually_exclusive,omitempty"`
}
func (GroupTreeNode) Children ¶
func (g GroupTreeNode) Children() []TreeNode
func (GroupTreeNode) GroupName ¶
func (g GroupTreeNode) GroupName() string
func (GroupTreeNode) IsGroup ¶
func (g GroupTreeNode) IsGroup() bool
func (GroupTreeNode) LayerID ¶
func (g GroupTreeNode) LayerID() string
type LayerAttribute ¶
type LayerAttribute struct {
Alias string `json:"alias,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Constraints Flags `json:"constraints,omitempty"`
Widget string `json:"widget,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
Format string `json:"format,omitempty"`
}
type LayerMeta ¶
type LayerMeta struct {
Id string `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
Type string `json:"type"`
Extent []float64 `json:"extent"`
Projection string `json:"projection"`
Flags Flags `json:"flags"`
LegendURL string `json:"legend_url,omitempty"`
Provider string `json:"provider_type"`
SourceParams QueryParams `json:"source_params"`
Metadata map[string]string `json:"metadata"`
Attribution map[string]string `json:"attribution,omitempty"`
Attributes []LayerAttribute `json:"attributes,omitempty"` // vector layers
Bands []string `json:"bands,omitempty"` // raster layers
Options map[string]json.RawMessage `json:"options,omitempty"`
Visible bool `json:"visible"`
Relations []map[string]any `json:"relations,omitempty"`
}
type LayerPermission ¶
type LayerSettings ¶
type LayerSettings struct {
Flags Flags `json:"flags"`
Attributes map[string]AttributeSettings `json:"attributes"`
InfoPanelComponent string `json:"infopanel_component,omitempty"` // or group with other possible settings into generic map[string]interface{}
// AttributeTableFields []string `json:"attr_table_fields,omitempty"` // TODO: remove
// InfoPanelFields []string `json:"info_panel_fields,omitempty"` // TODO: remove
ExportFields []string `json:"export_fields,omitempty"`
// FieldsOrder json.RawMessage `json:"fields_order,omitempty"`
// ExcludedFields json.RawMessage `json:"excluded_fields,omitempty"`
FieldsOrder *FieldsConfig `json:"fields_order,omitempty"`
ExcludedFields *FieldsConfig `json:"excluded_fields,omitempty"`
LegendDisabled bool `json:"legend_disabled,omitempty"`
QgisRelations map[string]map[string]any `json:"qgis_relations,omitempty"`
Relations []map[string]any `json:"relations,omitempty"`
CustomProperties json.RawMessage `json:"custom,omitempty"`
}
type LayerTreeNode ¶
type LayerTreeNode struct {
ID string `json:"id"`
}
func (LayerTreeNode) Children ¶
func (l LayerTreeNode) Children() []TreeNode
func (LayerTreeNode) GroupName ¶
func (l LayerTreeNode) GroupName() string
func (LayerTreeNode) IsGroup ¶
func (l LayerTreeNode) IsGroup() bool
func (LayerTreeNode) LayerID ¶
func (l LayerTreeNode) LayerID() string
type ParamValue ¶
type ParamValue []string
type ParamValue struct {
values []string
}
func (p *ParamValue) UnmarshalJSON(b []byte) error {
if len(b) == 0 {
return fmt.Errorf("no bytes to unmarshal")
}
switch b[0] {
case '"':
var value string
if err := json.Unmarshal(b, &value); err != nil {
return err
}
p.values = []string{value}
case '[':
return json.Unmarshal(b, &p.values)
}
return nil
}
func (p *ParamValue) String() string {
if len(p.values) > 0 {
return p.values[0]
}
return ""
}
func (p *ParamValue) StringArray() []string {
return p.values
}
func (*ParamValue) String ¶
func (p *ParamValue) String() string
func (*ParamValue) StringArray ¶
func (p *ParamValue) StringArray() []string
func (*ParamValue) UnmarshalJSON ¶
func (p *ParamValue) UnmarshalJSON(b []byte) error
type Project ¶
type Project struct {
Info ProjectFileInfo
Meta map[string]interface{}
Settings ProjectSettings
}
TODO: remove
func (*Project) ProjectionCode ¶
type ProjectFile ¶
type ProjectFileInfo ¶
Old code, currently used in mapcache package
type ProjectInfo ¶
type ProjectInfo struct {
Name string `json:"name,omitempty"`
Title string `json:"title"`
QgisFile string `json:"qgis_file"`
Created time.Time `json:"created"`
LastUpdate time.Time `json:"last_update"`
Projection string `json:"projection"` // projection code
Mapcache bool `json:"mapcache"`
Authentication string `json:"authentication"`
// empty, pending update, hidden
State string `json:"state"`
Size int64 `json:"size"` // size in bytes
Thumbnail bool `json:"thumbnail"`
}
type ProjectRole ¶
type ProjectRole struct {
Auth string `json:"type"`
Name string `json:"name"`
Note string `json:"note,omitempty"`
Users []string `json:"users"`
Permissions RolePermissions `json:"permissions"`
}
func FilterUserRoles ¶
func FilterUserRoles(u User, roles []ProjectRole) []ProjectRole
type ProjectSettings ¶
type ProjectSettings struct {
Auth Authentication `json:"auth"`
SettingsAuth SettingsAuthentication `json:"settings_auth"`
BaseLayers []string `json:"base_layers"`
Layers map[string]LayerSettings `json:"layers"`
Groups map[string]GroupSettings `json:"groups"`
Title string `json:"title"`
MapCache bool `json:"use_mapcache"`
Topics []Topic `json:"topics"`
Extent []float64 `json:"extent"`
InitialExtent []float64 `json:"initial_extent"`
Scales json.RawMessage `json:"scales"`
TileResolutions []float64 `json:"tile_resolutions"`
MapTiling bool `json:"map_tiling"`
Formatters []json.RawMessage `json:"formatters,omitempty"`
Proj4 map[string]string `json:"proj4,omitempty"`
Geocoding *Geocoding `json:"geocoding"`
SearchByLocation bool `json:"search_by_coords"`
}
func (ProjectSettings) UserLayerAttrinutesFlags ¶
func (s ProjectSettings) UserLayerAttrinutesFlags(u User, layerId string) map[string]Flags
func (ProjectSettings) UserLayerPermissionsFlags ¶
func (s ProjectSettings) UserLayerPermissionsFlags(u User, layerId string) Flags
type Projection ¶
type ProjectsRepository ¶
type ProjectsRepository interface {
CheckProjectExists(name string) bool
Create(name string, qmeta json.RawMessage) (*ProjectInfo, error)
AllProjects(skipErrors bool) ([]string, error)
UserProjects(user string) ([]string, error) // or should it require User object?
GetProjectInfo(name string) (ProjectInfo, error)
Delete(name string) error
// SaveFile(projectName, filename string, r io.Reader) error
CreateFile(projectName, directory, pattern string, r io.Reader) (ProjectFile, error)
SaveFile(project string, finfo ProjectFile, path string) error
GetFileInfo(project, path string) (FileInfo, error)
GetFilesInfo(project string, paths ...string) (map[string]FileInfo, error)
ListProjectFiles(project string, checksum bool) ([]ProjectFile, []ProjectFile, error)
ParseQgisMetadata(projectName string, data interface{}) error
UpdateMeta(projectName string, meta json.RawMessage) error
GetSettings(projectName string) (ProjectSettings, error)
UpdateSettings(projectName string, data json.RawMessage) error
GetThumbnailPath(projectName string) string
SaveThumbnail(projectName string, r io.Reader) error
UpdateFiles(projectName string, info FilesChanges, next FilesReader) ([]ProjectFile, error)
GetScripts(projectName string) (Scripts, error)
UpdateScripts(projectName string, scripts Scripts) error
GetProjectCustomizations(projectName string) (json.RawMessage, error)
Close()
}
type QgisMeta ¶
type QgisMeta struct {
File string `json:"file"`
Title string `json:"title"`
Extent []float64 `json:"extent"`
Scales []float64 `json:"scales"`
// LayersTree []TreeNode `json:"layers_tree"`
LayersTree []interface{} `json:"layers_tree"`
LayersOrder []string `json:"layers_order"`
BaseLayers []string `json:"base_layers"`
Layers map[string]LayerMeta `json:"layers"`
Projection string `json:"projection"`
Projections map[string]*Projection `json:"projections"`
Units map[string]interface{} `json:"units"`
ComposerTemplates []interface{} `json:"composer_templates"`
Client map[string]interface{} `json:"client_info"`
ProjectHash string `json:"project_hash"`
}
type QueryParams ¶
type QueryParams map[string]json.RawMessage
func (QueryParams) String ¶
func (p QueryParams) String(key string) string
func (QueryParams) StringArray ¶
func (p QueryParams) StringArray(key string) []string
func (QueryParams) Value ¶
func (p QueryParams) Value(key string) (ParamValue, bool)
type RolePermissions ¶
type ScriptModule ¶
type Scripts ¶
type Scripts map[string]ScriptModule
type SearchQueryParam ¶
type SettingsAuthentication ¶
type SettingsAuthentication struct {
AdminUsers []string `json:"admin_users,omitempty"`
}
type StringArray ¶
type StringArray = Flags
type TreeNode ¶
type TreeNode interface {
IsGroup() bool
Children() []TreeNode
GroupName() string
LayerID() string
}
func CreateTree2 ¶
type User ¶
type User struct {
Username string `json:"username"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
IsSuperuser bool `json:"is_superuser"`
IsAuthenticated bool `json:"-"`
IsGuest bool `json:"is_guest"`
Profile Profile `json:"profile,omitempty"`
}
func AccountToUser ¶
type UserRolesPermissions ¶
type UserRolesPermissions struct {
// contains filtered or unexported fields
}
func NewUserRolesPermissions ¶
func NewUserRolesPermissions(user User, auth Authentication) *UserRolesPermissions
func (*UserRolesPermissions) AttributesFlags ¶
func (p *UserRolesPermissions) AttributesFlags(layerId string) map[string]Flags
func (*UserRolesPermissions) LayerFlags ¶
func (p *UserRolesPermissions) LayerFlags(layerId string) Flags
func (*UserRolesPermissions) UserTopics ¶
func (p *UserRolesPermissions) UserTopics() []string
Click to show internal directories.
Click to hide internal directories.