MCPcopy
hub / github.com/ory/hydra / BeforeSave

Method BeforeSave

client/client.go:393–421  ·  view source on GitHub ↗
(_ *pop.Connection)

Source from the content-addressed store, hash-verified

391}
392
393func (c *Client) BeforeSave(_ *pop.Connection) error {
394 if c.JSONWebKeys == nil {
395 c.JSONWebKeys = new(x.JoseJSONWebKeySet)
396 }
397
398 if c.Metadata == nil {
399 c.Metadata = []byte("{}")
400 }
401
402 if c.Audience == nil {
403 c.Audience = sqlxx.StringSliceJSONFormat{}
404 }
405
406 if c.AllowedCORSOrigins == nil {
407 c.AllowedCORSOrigins = sqlxx.StringSliceJSONFormat{}
408 }
409
410 if c.CreatedAt.IsZero() {
411 c.CreatedAt = time.Now()
412 }
413 c.CreatedAt = c.CreatedAt.UTC()
414
415 if c.UpdatedAt.IsZero() {
416 c.UpdatedAt = time.Now()
417 }
418 c.UpdatedAt = c.UpdatedAt.UTC()
419
420 return nil
421}
422
423func (c *Client) GetID() string {
424 return c.ID

Callers

nothing calls this directly

Calls 2

NowMethod · 0.65
IsZeroMethod · 0.45

Tested by

no test coverage detected