database.go 798 B

123456789101112131415161718192021222324252627282930313233343536
  1. package models
  2. import (
  3. "github.com/porter-dev/porter/api/types"
  4. "gorm.io/gorm"
  5. )
  6. type Database struct {
  7. gorm.Model
  8. ProjectID uint `json:"project_id"`
  9. Project Project
  10. ClusterID uint `json:"cluster_id"`
  11. InfraID uint `json:"infra_id"`
  12. Infra Infra
  13. InstanceID string `json:"rds_instance_id"`
  14. InstanceEndpoint string `json:"rds_connection_endpoint"`
  15. InstanceName string `json:"rds_instance_name"`
  16. Status string
  17. }
  18. func (d *Database) ToDatabaseType() *types.Database {
  19. return &types.Database{
  20. ID: d.ID,
  21. ProjectID: d.ProjectID,
  22. ClusterID: d.ClusterID,
  23. InfraID: d.InfraID,
  24. InstanceID: d.InstanceID,
  25. InstanceEndpoint: d.InstanceEndpoint,
  26. InstanceName: d.InstanceName,
  27. Status: d.Status,
  28. }
  29. }