MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / create

Function create

chirpstack/src/storage/device_keys.rs:43–54  ·  view source on GitHub ↗
(dk: DeviceKeys)

Source from the content-addressed store, hash-verified

41}
42
43pub async fn create(dk: DeviceKeys) -> Result<DeviceKeys, Error> {
44 let dk: DeviceKeys = diesel::insert_into(device_keys::table)
45 .values(&dk)
46 .get_result(&mut get_async_db_conn().await?)
47 .await
48 .map_err(|e| Error::from_diesel(e, dk.dev_eui.to_string()))?;
49 info!(
50 dev_eui = %dk.dev_eui,
51 "Device-keys created"
52 );
53 Ok(dk)
54}
55
56pub async fn get(dev_eui: &EUI64) -> Result<DeviceKeys, Error> {
57 let dk = device_keys::dsl::device_keys

Callers 1

create_device_keysFunction · 0.70

Calls 2

to_stringMethod · 0.80
get_async_db_connFunction · 0.70

Tested by

no test coverage detected