Infrastructure methods
I have taken the Observer Pattern as the goal to implement the project. The main objects are Publisher and Subscriber. The Publisher delivers a message to the Subscribers. The information consists of temperatures that were measured.
Exports
Database methods
- connect, create, gather, update, delete
 
connect
RbO.connect — Function.connect(path::String)::SQLite.DBReturns a database.
Example
julia> using RbO
julia> db = connect("./rbo.sqlite")
SQLite.DB("./rbo.sqlite")connect()::SQLite.DBReturns an in-memory database.
Example
julia> using RbO
julia> db = connect()
SQLite.DB(in-memory)create
RbO.create — Function.create( db::SQLite.DB, table::String, domainItems::Array{Subscriber, 1} )Store subscribes in a database table.
Example
julia> using RbO
julia> daisy = createSubscriber( "Daisy" );
julia> mickey = createSubscriber( "Mickey" );
julia> data = [ daisy, mickey ];
julia> db = connect()
SQLite.DB(in-memory)
julia> create( db, "subscribers", data )
"subscribers"create( db::SQLite.DB, table::String, domainItems::Array{Publisher, 1} )Store publishers in a database table.
Exampple
julia> using RbO
julia> nyt = createPublisher( "The New York Times" );
julia> db = connect()
SQLite.DB(in-memory)
julia> create(db, "publishers", [ nyt ])
"publishers"create( db::SQLite.DB, table::String, domainItems::Array{Message, 1} )Store publishers in a database table.
gather (read)
RbO.gather — Function.gather( db::SQLite.DB, table::String )::DataFrameReturns a dataframe with all entries
julia> using RbO
julia> daisy = createSubscriber( "Daisy" )
Subscriber("14400338531749444750", "Daisy", "", MEAN_CALCULATOR::SubscriberType = 0)
julia> mickey = createSubscriber( "Mickey" )
Subscriber("7987502302757180929", "Mickey", "", MEAN_CALCULATOR::SubscriberType = 0)
julia> db = connect()
SQLite.DB(in-memory)
julia> create( db, "subscribers", [ daisy, mickey ] )
"subscribers"
julia> gather(db, "subscribers")
┌ Warning: `T` is deprecated, use `nonmissingtype` instead.
│   caller = compacttype(::Type, ::Int64) at show.jl:39
└ @ DataFrames ~/.julia/packages/DataFrames/XuYBH/src/abstractdataframe/show.jl:39
2×5 DataFrames.DataFrame
│ Row │ time      │ agent   │ action  │ key                  │ item                                                             │
│     │ Float64⍰  │ String⍰ │ String⍰ │ String⍰              │ Union{Missing, Subscriber}                                       │
├─────┼───────────┼─────────┼─────────┼──────────────────────┼──────────────────────────────────────────────────────────────────┤
│ 1   │ 1.56812e9 │ AB9F    │ CREATE  │ 14400338531749444750 │ Subscriber("14400338531749444750", "Daisy", "", MEAN_CALCULATOR) │
│ 2   │ 1.56812e9 │ AB9F    │ CREATE  │ 7987502302757180929  │ Subscriber("7987502302757180929", "Mickey", "", MEAN_CALCULATOR) │gather( db::SQLite.DB, table::String, condition::String )::DataFrameReturn a DataFrame with all entries.
Example
julia> using RbO
julia> daisy = createSubscriber( "Daisy" )
Subscriber("5270518311956369638", "Daisy", "", MEAN_CALCULATOR::SubscriberType = 0)
julia> mickey = createSubscriber( "Mickey" )
Subscriber("8580492032810188742", "Mickey", "", MEAN_CALCULATOR::SubscriberType = 0)
julia> db = connect()
SQLite.DB(in-memory)
julia> create( db, "subscribers", [ daisy, mickey ] )
 "subscribers"
julia> gather( db, "subscribers", "key = '" * daisy.id * "'" )
1×5 DataFrames.DataFrame
│ Row │ time      │ agent   │ action  │ key                 │ item                                                            │
│     │ Float64⍰  │ String⍰ │ String⍰ │ String⍰             │ Union{Missing, Subscriber}                                      │
├─────┼───────────┼─────────┼─────────┼─────────────────────┼─────────────────────────────────────────────────────────────────┤
│ 1   │ 1.56812e9 │ AB9F    │ CREATE  │ 5270518311956369638 │ Subscriber("5270518311956369638", "Daisy", "", MEAN_CALCULATOR) │update
RbO.update — Function.update( db::SQLite.DB, table::String, domainItems::Array{Subscribers, 1} )Example
julia> using RbO
julia> daisy = createSubscriber( "Daisy" )
Subscriber("5270518311956369638", "Daisy", "", MEAN_CALCULATOR::SubscriberType = 0)
julia> mickey = createSubscriber( "Mickey" )
Subscriber("8580492032810188742", "Mickey", "", MEAN_CALCULATOR::SubscriberType = 0)
julia> db = connect()
SQLite.DB(in-memory)
julia> create( db, "subscribers", [ daisy, mickey ] )
 "subscribers"
julia> gather( db, "subscribers", "key = '" * daisy.id * "'" )
1×5 DataFrames.DataFrame
│ Row │ time      │ agent   │ action  │ key                 │ item                                                            │
│     │ Float64⍰  │ String⍰ │ String⍰ │ String⍰             │ Union{Missing, Subscriber}                                      │
├─────┼───────────┼─────────┼─────────┼─────────────────────┼─────────────────────────────────────────────────────────────────┤
│ 1   │ 1.56812e9 │ AB9F    │ CREATE  │ 5270518311956369638 │ Subscriber("5270518311956369638", "Daisy", "", MEAN_CALCULATOR) │
daisy = updateSubscriber( daisy, "Daisy Duck", "daisy@duckcity.com", daisy.subscribertype )
Subscriber("5270518311956369638", "Daisy Duck", "daisy@duckcity.com", MEAN_CALCULATOR::SubscriberType = 0)
julia> update( db, "subscribers", [daisy] )
"subscribers"
julia> gather( db, "subscribers", "key = '" * daisy.id * "'" )
2×5 DataFrames.DataFrame
│ Row │ time      │ agent   │ action  │ key                 │ item                                                                                   │
│     │ Float64⍰  │ String⍰ │ String⍰ │ String⍰             │ Union{Missing, Subscriber}                                                             │
├─────┼───────────┼─────────┼─────────┼─────────────────────┼────────────────────────────────────────────────────────────────────────────────────────┤
│ 1   │ 1.56812e9 │ AB9F    │ CREATE  │ 5270518311956369638 │ Subscriber("5270518311956369638", "Daisy", "", MEAN_CALCULATOR)                        │
│ 2   │ 1.56812e9 │ AB9F    │ UPDATE  │ 5270518311956369638 │ Subscriber("5270518311956369638", "Daisy Duck", "daisy@duckcity.com", MEAN_CALCULATOR) │update( db::SQLite.DB, table::String, domainItems::Array{Publishers, 1} )Update publishers in a database table.
update( db::SQLite.DB, table::String, domainItems::Array{Message, 1} )Update messages in a database table.