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

Function create

chirpstack/src/storage/api_key.rs:53–63  ·  view source on GitHub ↗
(ak: ApiKey)

Source from the content-addressed store, hash-verified

51}
52
53pub async fn create(ak: ApiKey) -> Result<ApiKey, Error> {
54 ak.validate()?;
55
56 let ak: ApiKey = diesel::insert_into(api_key::table)
57 .values(&ak)
58 .get_result(&mut get_async_db_conn().await?)
59 .await
60 .map_err(|e| error::Error::from_diesel(e, ak.id.to_string()))?;
61 info!(id = %ak.id, "Api-key created");
62 Ok(ak)
63}
64
65pub async fn delete(id: &Uuid) -> Result<(), Error> {
66 let ra = diesel::delete(api_key::dsl::api_key.find(fields::Uuid::from(id)))

Callers 1

create_api_keyFunction · 0.70

Calls 3

to_stringMethod · 0.80
get_async_db_connFunction · 0.70
validateMethod · 0.45

Tested by

no test coverage detected