MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / Get

Method Get

service/universally/get.go:38–52  ·  view source on GitHub ↗
(ctx context.Context, uuid string)

Source from the content-addressed store, hash-verified

36}
37
38func (s *imlServiceGet[T, E]) Get(ctx context.Context, uuid string) (*T, error) {
39 where := map[string]interface{}{
40 "uuid": uuid,
41 }
42
43 v, err := s.store.First(ctx, where)
44 if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
45 return nil, err
46 }
47 if v == nil || errors.Is(err, gorm.ErrRecordNotFound) {
48 return nil, gorm.ErrRecordNotFound
49 }
50
51 return s.toModelHandler(v), nil
52}
53func (s *imlServiceGet[T, E]) List(ctx context.Context, uuids ...string) ([]*T, error) {
54 where := make([]string, 0, 2)
55 args := make([]interface{}, 0, 2)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected