How do I Pattern Match on a Database Query Return

How do I use pattern matching to extract the values from this.

TestBeds.get_test_bed!(testbed_id)

It returns

%App.TestBeds.TestBed{
  __meta__: #Ecto.Schema.Metadata<:loaded, "testbeds">,
  id: 1,
  developer: "None",
  name: "sdfsd",
  owner: "sdfsddf",
  note: "sdsfsddf",
  status: "Available",
  url: "sdf",
  version: "ddf",
  manager: "sf",
  inserted_at: ~N[2023-08-21 13:45:39],
  updated_at: ~N[2023-08-21 13:45:44]
}

I can use dot syntax to get each value one-by-one

item = TestBeds.get_test_bed!(testbed_id)
item.id
item.name

etc

I want to know how to destructure the data with “pattern matching”.
Thank you

How to do what with pattern-matching? This question is somewhat incomplete without that part.

A good place to start is the docs - check out the last paragraph in this section.

I want to know the pattern matching syntax to destructure the data. Does that make sense?

You can use the match operator: =

%App.TestBeds.TestBed{
  developer: developer,
  name: name,
  owner: owner
} = TestBeds.get_test_bed!(testbed_id)

This will match the developer, name, and owner fields to variables of the same name.