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

Function create

chirpstack/src/storage/device_profile.rs:238–249  ·  view source on GitHub ↗
(dp: DeviceProfile)

Source from the content-addressed store, hash-verified

236}
237
238pub async fn create(dp: DeviceProfile) -> Result<DeviceProfile, Error> {
239 dp.validate()
240 .map_err(|e| Error::Validation(e.to_string()))?;
241
242 let dp: DeviceProfile = diesel::insert_into(device_profile::table)
243 .values(&dp)
244 .get_result(&mut get_async_db_conn().await?)
245 .await
246 .map_err(|e| error::Error::from_diesel(e, dp.id.to_string()))?;
247 info!(id = %dp.id, "Device-profile created");
248 Ok(dp)
249}
250
251pub async fn get(id: &Uuid) -> Result<DeviceProfile, Error> {
252 let dp = device_profile::dsl::device_profile

Callers 2

create_device_profileFunction · 0.70
test_device_profileFunction · 0.70

Calls 3

to_stringMethod · 0.80
get_async_db_connFunction · 0.70
validateMethod · 0.45

Tested by 1

test_device_profileFunction · 0.56