Files
gogwapi/app/models/endpoint_group.go
2025-11-29 03:09:40 +01:00

25 lines
833 B
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type EndpointGroup struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
GroupID uuid.UUID `gorm:"not null;uniqueIndex:idx_endpoint_group_group_id_endpoint_id" json:"group_id"`
EndpointID uuid.UUID `gorm:"not null;uniqueIndex:idx_endpoint_group_group_id_endpoint_id" json:"endpoint_id"`
CreatedAt time.Time `gorm:"not null;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"not null;default:now()" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Group Group `gorm:"foreignKey:GroupID" json:"-"`
Endpoint Endpoint `gorm:"foreignKey:EndpointID" json:"-"`
}
func (EndpointGroup) TableName() string {
return "endpoint_groups"
}