MCPcopy
hub / github.com/tsuru/tsuru / Get

Function Get

service/service.go:90–103  ·  view source on GitHub ↗
(ctx context.Context, service string)

Source from the content-addressed store, hash-verified

88)
89
90func Get(ctx context.Context, service string) (Service, error) {
91 collection, err := storagev2.ServicesCollection()
92 if err != nil {
93 return Service{}, err
94 }
95 var s Service
96 if err := collection.FindOne(ctx, mongoBSON.M{"_id": service}).Decode(&s); err != nil {
97 if err == mongo.ErrNoDocuments {
98 return Service{}, ErrServiceNotFound
99 }
100 return Service{}, err
101 }
102 return s, nil
103}
104
105func Create(ctx context.Context, s Service) error {
106 if err := s.validate(ctx, false); err != nil {

Calls 1

ServicesCollectionFunction · 0.92