mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-08-05 18:29:24 +09:00
Merge branch 'add-types' into 'main'
Draft: (WIP) orm like functions See merge request wotsubo/PSBoardDataBase!1398
This commit is contained in:
commit
aabd117bf8
4 changed files with 36 additions and 1 deletions
|
@ -12,6 +12,8 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
|||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
|
||||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
||||
SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
|
||||
Strapping = "3787371a-436b-4cb0-be6b-e772a55e3ebe"
|
||||
StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
|
||||
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
|
||||
|
||||
[weakdeps]
|
||||
|
|
|
@ -7,6 +7,7 @@ using CSV
|
|||
using DataFrames
|
||||
using Dates
|
||||
|
||||
include("types.jl")
|
||||
include("parse_qaqc_master_log.jl")
|
||||
include("parse_clock.jl")
|
||||
|
||||
|
@ -76,6 +77,6 @@ function create_database_from_exported_csvs(
|
|||
db
|
||||
end
|
||||
|
||||
greet() = print("Hello World!")
|
||||
include("queries.jl")
|
||||
|
||||
end # module PSBoardDataBase
|
||||
|
|
9
src/queries.jl
Normal file
9
src/queries.jl
Normal file
|
@ -0,0 +1,9 @@
|
|||
function get_board_qaqc_summary(db::SQLite.DB, psboard_id::Int64)
|
||||
stmt = DBInterface.prepare(
|
||||
db,
|
||||
sql"SELECT * FROM qaqc_single_run_table WHERE psboard_id = (?)",
|
||||
)
|
||||
df = DBInterface.execute(stmt, (psboard_id,)) |> DataFrame
|
||||
|
||||
df
|
||||
end
|
|
@ -8,6 +8,29 @@ using Dates
|
|||
true || include("../src/PSBoardDataBase.jl")
|
||||
|
||||
@testset "PSBoardDataBase" begin
|
||||
@testset "types" begin
|
||||
@testset "StructTypes and Strapping" begin
|
||||
using Strapping
|
||||
|
||||
@info "" Strapping.construct(
|
||||
Vector{PSBoardDataBase.PsBoard},
|
||||
(id = [123, 10], daughterboard_id = [nothing, 12345]),
|
||||
)
|
||||
@test Strapping.construct(
|
||||
PSBoardDataBase.PsBoard,
|
||||
(id = [123], daughterboard_id = [nothing]),
|
||||
) == PSBoardDataBase.PsBoard(123, nothing)
|
||||
|
||||
@test Strapping.construct(
|
||||
Vector{PSBoardDataBase.PsBoard},
|
||||
[(100, nothing), (200, 12345)],
|
||||
) == PSBoardDataBase.PsBoard[
|
||||
PSBoardDataBase.PsBoard(100, nothing),
|
||||
PSBoardDataBase.PsBoard(200, 12345),
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@testset "parse master log" begin
|
||||
masterlog_metadata::PSBoardDataBase.QaqcMasterLog.QaqcMasterLogMetadata =
|
||||
PSBoardDataBase.QaqcMasterLog.parse_master_log("input/log/57_long.log")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue