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

Function create

chirpstack/src/storage/tenant.rs:183–193  ·  view source on GitHub ↗
(t: Tenant)

Source from the content-addressed store, hash-verified

181}
182
183pub async fn create(t: Tenant) -> Result<Tenant, Error> {
184 t.validate()?;
185
186 let t: Tenant = diesel::insert_into(tenant::table)
187 .values(&t)
188 .get_result(&mut get_async_db_conn().await?)
189 .await
190 .map_err(|e| Error::from_diesel(e, t.id.to_string()))?;
191 info!(id = %t.id, "Tenant created");
192 Ok(t)
193}
194
195pub async fn get(id: &Uuid) -> Result<Tenant, Error> {
196 let t = tenant::dsl::tenant

Callers 2

create_tenantFunction · 0.70

Calls 3

to_stringMethod · 0.80
get_async_db_connFunction · 0.70
validateMethod · 0.45