Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-julialib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-julialib
Commits
50cf9d24
Commit
50cf9d24
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Add `is_list` and `is_reference` to property creators
parent
eb57ac6c
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
ENH: Implement queries and entity retrieval
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Entity.jl
+22
-12
22 additions, 12 deletions
src/Entity.jl
with
22 additions
and
12 deletions
src/Entity.jl
+
22
−
12
View file @
50cf9d24
...
...
@@ -80,10 +80,10 @@ using CaosDB
# and C++ only understand all-capital strings for datatypes,
# importances, roles. What about user input like "record_type",
# "RecordType", "recordtype"?
"""
"""
Struct containing a pointer to the wrapped cpp entity
object. Meant for internal use; use `CaosDB.Entity.create_entity` to
create an entity.
create an entity.
"""
mutable struct
_Entity
wrapped_entity
::
Ptr
{
Cvoid
}
...
...
@@ -111,10 +111,10 @@ mutable struct _Entity
end
"""
"""
Struct containing a pointer to the wrapped cpp parent
object. Meant for internal use; use `CaosDB.Entity.create_parent` to
create an parent.
create an parent.
"""
mutable struct
_Parent
wrapped_parent
::
Ptr
{
Cvoid
}
...
...
@@ -142,10 +142,10 @@ mutable struct _Parent
end
"""
"""
Struct containing a pointer to the wrapped cpp property
object. Meant for internal use; use `CaosDB.Entity.create_property` to
create an property.
create an property.
"""
mutable struct
_Property
wrapped_property
::
Ptr
{
Cvoid
}
...
...
@@ -254,12 +254,15 @@ end
)
Return a new entity object with role Record. If `name`, `datatype`, or
`unit` were provided, its name, datatype, or unit are set accordingly.
`unit` were provided, its name, datatype (including whether it is a
reference or a list), or unit are set accordingly.
"""
function
create_property_entity
(;
name
::
AbstractString
=
""
,
datatype
::
AbstractString
=
""
,
unit
::
AbstractString
=
""
,
is_reference
::
Bool
=
false
,
is_list
::
Bool
=
false
,
)
property
=
create_entity
(
name
)
...
...
@@ -267,7 +270,7 @@ function create_property_entity(;
set_role
(
property
,
"PROPERTY"
)
if
datatype
!=
""
set_datatype
(
property
,
datatype
)
set_datatype
(
property
,
datatype
,
is_list
=
is_list
,
is_reference
=
is_reference
)
end
if
unit
!=
""
...
...
@@ -297,6 +300,9 @@ function create_property(;
name
::
AbstractString
=
""
,
id
::
AbstractString
=
""
,
value
::
AbstractString
=
""
,
datatype
::
AbstractString
=
""
,
is_reference
::
Bool
=
false
,
is_list
::
Bool
=
false
,
)
property
=
Ref
{
_Property
}(
_Property
(
true
))
...
...
@@ -317,6 +323,10 @@ function create_property(;
set_id
(
property
,
id
)
end
if
datatype
!=
""
set_datatype
(
property
,
datatype
,
is_reference
=
is_reference
,
is_list
=
is_list
)
end
if
value
!=
""
set_value
(
property
,
value
)
end
...
...
@@ -609,7 +619,7 @@ end
function get_datatype(entity::Ref{_Entity})
Return a tuple that contains the name of the datatype of the given
`entity`, whether it is a reference, and whether it is a list.
`entity`, whether it is a reference, and whether it is a list.
"""
function
get_datatype
(
entity
::
Ref
{
_Entity
})
...
...
@@ -1264,7 +1274,7 @@ to set the id of entities.
function
set_id
(
entity
::
Ref
{
_Entity
},
id
::
AbstractString
)
throw
(
CaosDB
.
Exceptions
.
ClientException
(
"You cannot set the id of an entity object.
"You cannot set the id of an entity object.
If you want to update an entity with this id, you have to retrieve it first."
,
),
)
...
...
@@ -1396,7 +1406,7 @@ end
# too?
"""
function set_datatype(
entity::Ref{_Entity},
entity::Ref{_Entity},
datatype::AbstractString;
is_list::Bool = false,
is_reference::Bool = false,
...
...
@@ -1440,7 +1450,7 @@ end
"""
function set_datatype(
property::Ref{_Property},
property::Ref{_Property},
datatype::AbstractString;
is_list::Bool = false,
is_reference::Bool = false,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment