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
13b09296
Commit
13b09296
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: ADD enums for datatype, importance, role, and collection
parent
223e231c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!13
ENH: Use new value and datatype structs
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/CaosDB.jl
+1
-1
1 addition, 1 deletion
src/CaosDB.jl
src/Constants.jl
+41
-1
41 additions, 1 deletion
src/Constants.jl
src/Entity.jl
+7
-5
7 additions, 5 deletions
src/Entity.jl
with
49 additions
and
7 deletions
src/CaosDB.jl
+
1
−
1
View file @
13b09296
...
...
@@ -29,7 +29,7 @@ export evaluate_return_code,
CaosDBException
,
ClientException
,
GenericCaosDBException
,
CaosDBMessage
# Exports from module Constants
export
MIN_CCAOSDB_VERSION
export
COLLECTION
,
DATATYPE
,
IMPORTANCE
,
MIN_CCAOSDB_VERSION
,
ROLE
# Exports from module Utility
export
get_ccaosdb_version
,
get_env_fallback
...
...
This diff is collapsed.
Click to expand it.
src/Constants.jl
+
41
−
1
View file @
13b09296
...
...
@@ -23,7 +23,7 @@
module
Constants
export
MIN_CCAOSDB_VERSION
export
COLLECTION
,
DATATYPE
,
IMPORTANCE
,
MIN_CCAOSDB_VERSION
,
ROLE
"""
The minimum version of CaosDB's cpplib and C interface that is
...
...
@@ -31,4 +31,44 @@ supported by this version of CaosDB.jl.
"""
const
MIN_CCAOSDB_VERSION
=
v
"0.0.17"
# enums have to be encapsulated in modules to prevent namespce conflicts, see
# https://bleepcoder.com/julia/413856244/feature-request-getproperty-on-enum-type-to-access-instances
module
DATATYPE
@enum
_DATATYPE
begin
UNSPECIFIED
BOOLEAN
INTEGER
DOUBLE
DATETIME
TEXT
end
end
module
COLLECTION
@enum
_COLLECTION
begin
SCALAR
LIST
end
end
module
ROLE
@enum
_ROLE
begin
UNSPECIFIED
RECORD
RECORD_TYPE
PROPERTY
FILE
end
end
module
IMPORTANCE
@enum
_IMPORTANCE
begin
UNSPECIFIED
OBLIGATORY
RECOMMENDED
SUGGESTED
FIX
end
end
end
This diff is collapsed.
Click to expand it.
src/Entity.jl
+
7
−
5
View file @
13b09296
...
...
@@ -200,7 +200,7 @@ Struct containing a pointer to the wrapped cpp DataType object. Meant for
internal use only; use `CaosDB.Entity.create_<type>_datatype` to create a
valid _DataType object or use the `set/get_datatype` functions.
"""
mutable struct
_Data
t
Type
mutable struct
_DataType
wrapped_datatype
::
Ptr
{
Cvoid
}
_deletable
::
Bool
...
...
@@ -214,7 +214,7 @@ mutable struct _DatatType
ccall
(
(
:
caosdb_entity_delete_datatype
,
CaosDB
.
library_name
),
Cint
,
(
Ref
{
_Data
t
Type
},),
(
Ref
{
_DataType
},),
Ref
{
_DataType
}(
t
),
)
end
...
...
@@ -568,7 +568,7 @@ function create_list_of_reference_datatype(name::AbstractString)
end
function
create_value
(
value
::
Union
{
AbstractString
,
Number
,
Bool
,
V
a
ctor
{
T
}},
value
::
Union
{
AbstractString
,
Number
,
Bool
,
V
e
ctor
{
T
}},
)
where
{
T
<:
Union
{
AbstractString
,
Number
,
Bool
}}
in_type
=
typeof
(
value
)
...
...
@@ -643,8 +643,10 @@ function create_value(
)
else
# Should never enter here but treat it just in case
@throw
ArgumentError
(
"The argument of type
$
in_type couldn't be converted into a valid CaosDB value object."
,
throw
(
ArgumentError
(
"The argument of type
$
in_type couldn't be converted into a valid CaosDB value object."
,
),
)
end
...
...
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