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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-julialib
Commits
0be053a7
Commit
0be053a7
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
DRAFT: Add a lot of setters, getters, and helper functions
parent
f5bd5529
No related branches found
No related tags found
1 merge request
!7
ENH: Implement queries and entity retrieval
Pipeline
#11994
failed
3 years ago
Stage: info
Stage: code-style
Stage: setup
Stage: test
Stage: deploy
Changes
5
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/CaosDB.jl
+2
-0
2 additions, 0 deletions
src/CaosDB.jl
src/Connection.jl
+6
-0
6 additions, 0 deletions
src/Connection.jl
src/Entity.jl
+1133
-4
1133 additions, 4 deletions
src/Entity.jl
src/Transaction.jl
+2
-0
2 additions, 0 deletions
src/Transaction.jl
test/runtests.jl
+11
-8
11 additions, 8 deletions
test/runtests.jl
with
1154 additions
and
12 deletions
src/CaosDB.jl
+
2
−
0
View file @
0be053a7
...
@@ -173,9 +173,11 @@ authenticator object from a configuration.
...
@@ -173,9 +173,11 @@ authenticator object from a configuration.
"""
"""
mutable struct
_Authenticator
mutable struct
_Authenticator
wrapped_authenticator
::
Ptr
{
Cvoid
}
wrapped_authenticator
::
Ptr
{
Cvoid
}
_deletable
::
Bool
function
_Authenticator
(
managed_by_julia
::
Bool
=
false
)
function
_Authenticator
(
managed_by_julia
::
Bool
=
false
)
auth
=
new
()
auth
=
new
()
auth
.
_deletable
=
false
if
managed_by_julia
if
managed_by_julia
# Only append a finalizer for this if the object is
# Only append a finalizer for this if the object is
# actually managed by Julia and not created and destroyed
# actually managed by Julia and not created and destroyed
...
...
This diff is collapsed.
Click to expand it.
src/Connection.jl
+
6
−
0
View file @
0be053a7
...
@@ -34,9 +34,11 @@ to create an connection object from a configuration.
...
@@ -34,9 +34,11 @@ to create an connection object from a configuration.
"""
"""
mutable struct
_Connection
mutable struct
_Connection
wrapped_connection
::
Ptr
{
Cvoid
}
wrapped_connection
::
Ptr
{
Cvoid
}
_deletable
::
Bool
function
_Connection
(
managed_by_julia
::
Bool
=
false
)
function
_Connection
(
managed_by_julia
::
Bool
=
false
)
conn
=
new
()
conn
=
new
()
conn
.
_deletable
=
false
if
managed_by_julia
if
managed_by_julia
# Only append a finalizer for this if the object is
# Only append a finalizer for this if the object is
# actually managed by Julia and not created and destroyed
# actually managed by Julia and not created and destroyed
...
@@ -63,9 +65,11 @@ an certificate-provider object from a configuration.
...
@@ -63,9 +65,11 @@ an certificate-provider object from a configuration.
"""
"""
mutable struct
_CertificateProvider
mutable struct
_CertificateProvider
wrapped_certificate_provider
::
Ptr
{
Cvoid
}
wrapped_certificate_provider
::
Ptr
{
Cvoid
}
_deletable
::
Bool
function
_CertificateProvider
(
managed_by_julia
::
Bool
=
false
)
function
_CertificateProvider
(
managed_by_julia
::
Bool
=
false
)
prov
=
new
()
prov
=
new
()
prov
.
_deletable
=
false
if
managed_by_julia
if
managed_by_julia
# Only append a finalizer for this if the object is
# Only append a finalizer for this if the object is
# actually managed by Julia and not created and destroyed
# actually managed by Julia and not created and destroyed
...
@@ -92,9 +96,11 @@ an connection-configuration object from a configuration.
...
@@ -92,9 +96,11 @@ an connection-configuration object from a configuration.
"""
"""
mutable struct
_Configuration
mutable struct
_Configuration
wrapped_connection_configuration
::
Ptr
{
Cvoid
}
wrapped_connection_configuration
::
Ptr
{
Cvoid
}
_deletable
::
Bool
function
_Configuration
(
managed_by_julia
::
Bool
=
false
)
function
_Configuration
(
managed_by_julia
::
Bool
=
false
)
config
=
new
()
config
=
new
()
config
.
_deletable
(
false
)
if
managed_by_julia
if
managed_by_julia
# Only append a finalizer for this if the object is
# Only append a finalizer for this if the object is
# actually managed by Julia and not created and destroyed
# actually managed by Julia and not created and destroyed
...
...
This diff is collapsed.
Click to expand it.
src/Entity.jl
+
1133
−
4
View file @
0be053a7
This diff is collapsed.
Click to expand it.
src/Transaction.jl
+
2
−
0
View file @
0be053a7
...
@@ -35,8 +35,10 @@ object.
...
@@ -35,8 +35,10 @@ object.
"""
"""
mutable struct
_Transaction
mutable struct
_Transaction
wrapped_transaction
::
Ptr
{
Cvoid
}
wrapped_transaction
::
Ptr
{
Cvoid
}
_deletable
::
Bool
function
_Transaction
(
managed_by_julia
::
Bool
=
false
)
function
_Transaction
(
managed_by_julia
::
Bool
=
false
)
trans
=
new
()
trans
=
new
()
trans
.
_deletable
=
false
if
managed_by_julia
if
managed_by_julia
function
f
(
t
)
function
f
(
t
)
ccall
(
ccall
(
...
...
This diff is collapsed.
Click to expand it.
test/runtests.jl
+
11
−
8
View file @
0be053a7
...
@@ -68,7 +68,7 @@ using CaosDB
...
@@ -68,7 +68,7 @@ using CaosDB
# return the correct code (Change it if this ever changes in
# return the correct code (Change it if this ever changes in
# libcaosdb)
# libcaosdb)
client_err
=
CaosDB
.
Exceptions
.
ClientException
(
"Client error"
)
client_err
=
CaosDB
.
Exceptions
.
ClientException
(
"Client error"
)
@test
client_err
.
msg
==
"Client
_Er
r"
@test
client_err
.
msg
==
"Client
erro
r"
@test
client_err
.
code
==
9999
@test
client_err
.
code
==
9999
end
end
...
@@ -107,25 +107,28 @@ using CaosDB
...
@@ -107,25 +107,28 @@ using CaosDB
rec_with_parent_and_props
=
CaosDB
.
Entity
.
create_record
(
"TestRec"
)
rec_with_parent_and_props
=
CaosDB
.
Entity
.
create_record
(
"TestRec"
)
# cannot set an ID
# cannot set an ID
@test_throws
CaosDB
.
Exceptions
.
ClientException
CaosDB
.
Entity
.
set_id
(
"some_id"
)
@test_throws
CaosDB
.
Exceptions
.
ClientException
CaosDB
.
Entity
.
set_id
(
rec_with_parent_and_props
,
"some_id"
,
)
par1
=
CaosDB
.
Entity
.
create_parent
(
name
=
"Parent1"
)
par1
=
CaosDB
.
Entity
.
create_parent
(
name
=
"Parent1"
)
par2
=
CaosDB
.
Entity
.
create_parent
(
name
=
"Parent2"
,
id
=
"id_of_parent_2"
)
par2
=
CaosDB
.
Entity
.
create_parent
(
name
=
"Parent2"
,
id
=
"id_of_parent_2"
)
CaosDB
.
Entity
.
append_parents
(
rec_with_parent_and_props
,
[
par1
,
par2
])
CaosDB
.
Entity
.
append_parents
(
rec_with_parent_and_props
,
[
par1
,
par2
])
@test
length
(
CaosDB
.
Entity
.
get_parents
(
rec_with_parent_and_props
))
==
2
@test
length
(
CaosDB
.
Entity
.
get_parents
(
rec_with_parent_and_props
))
==
2
@test
CaosDB
.
Entity
.
get_name
(
@test
CaosDB
.
Entity
.
get_name
(
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
1
),
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
Cint
(
1
)
),
)
==
"Parent1"
)
==
"Parent1"
@test
CaosDB
.
Entity
.
get_name
(
@test
CaosDB
.
Entity
.
get_name
(
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
2
),
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
Cint
(
2
)
),
)
==
"Parent2"
)
==
"Parent2"
@test
CaosDB
.
Entity
.
get_id
(
@test
CaosDB
.
Entity
.
get_id
(
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
2
),
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
Cint
(
2
)
),
)
==
"id_of_parent_2"
)
==
"id_of_parent_2"
CaosDB
.
Entity
.
remove_parent
(
rec_with_parent_and_props
,
1
)
CaosDB
.
Entity
.
remove_parent
(
rec_with_parent_and_props
,
Cint
(
1
)
)
@test
length
(
CaosDB
.
Entity
.
get_parents
(
rec_with_parent_and_props
))
==
1
@test
length
(
CaosDB
.
Entity
.
get_parents
(
rec_with_parent_and_props
))
==
1
@test
CaosDB
.
Entity
.
get_name
(
@test
CaosDB
.
Entity
.
get_name
(
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
1
),
CaosDB
.
Entity
.
get_parent
(
rec_with_parent_and_props
,
Cint
(
1
)
),
)
==
"Parent2"
)
==
"Parent2"
prop1
=
CaosDB
.
Entity
.
create_property
(
name
=
"Property1"
,
value
=
"2"
)
prop1
=
CaosDB
.
Entity
.
create_property
(
name
=
"Property1"
,
value
=
"2"
)
...
@@ -144,7 +147,7 @@ using CaosDB
...
@@ -144,7 +147,7 @@ using CaosDB
@test
CaosDB
.
Entity
.
get_id
(
@test
CaosDB
.
Entity
.
get_id
(
CaosDB
.
Entity
.
get_properties
(
rec_with_parent_and_props
)[
2
],
CaosDB
.
Entity
.
get_properties
(
rec_with_parent_and_props
)[
2
],
)
==
"id_of_property_2"
)
==
"id_of_property_2"
CaosDB
.
Entity
.
remove_property
(
rec_with_parent_and_props
,
2
)
CaosDB
.
Entity
.
remove_property
(
rec_with_parent_and_props
,
Cint
(
2
)
)
@test
length
(
CaosDB
.
Entity
.
get_properties
(
rec_with_parent_and_props
))
==
2
@test
length
(
CaosDB
.
Entity
.
get_properties
(
rec_with_parent_and_props
))
==
2
@test
CaosDB
.
Entity
.
get_name
(
@test
CaosDB
.
Entity
.
get_name
(
CaosDB
.
Entity
.
get_properties
(
rec_with_parent_and_props
)[
2
],
CaosDB
.
Entity
.
get_properties
(
rec_with_parent_and_props
)[
2
],
...
...
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