cred_exchange_token.go 346 B

123456789101112131415161718192021222324
  1. package models
  2. import (
  3. "time"
  4. "gorm.io/gorm"
  5. )
  6. type CredentialsExchangeToken struct {
  7. gorm.Model
  8. ProjectID uint
  9. Token []byte
  10. Expiry *time.Time
  11. DOCredentialID uint
  12. AWSCredentialID uint
  13. GCPCredentialID uint
  14. }
  15. func (t *CredentialsExchangeToken) IsExpired() bool {
  16. timeLeft := t.Expiry.Sub(time.Now())
  17. return timeLeft < 0
  18. }