Documentation
¶
Index ¶
Constants ¶
View Source
const ( // For gcp cloud postgres database GoogleProject = "GOOGLE_CLOUD_PROJECT_ID" DatabaseRegion = "DATABASE_REGION" DatabasesInstance = "DATABASE_INSTANCE" DBHost = "POSTGRES_HOST" DBPort = "POSTGRES_PORT" DBUser = "POSTGRES_USER" DBPassword = "POSTGRES_PASSWORD" DBName = "POSTGRES_DB" )
Variables ¶
This section is empty.
Functions ¶
func RunMigrations ¶
func RunMigrations() error
RunMigrations looks at the currently active migration version and will migrate all the way up (applying all up migrations)
Types ¶
type Base ¶
type Base struct { ID *string `gorm:"primaryKey;unique;column:id"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` CreatedBy *string `gorm:"column:created_by"` UpdatedBy *string `gorm:"column:updated_by"` DeletedAt *time.Time `gorm:"column:deleted_at"` Active bool `gorm:"column:active"` }
Base model contains defines common fields across tables
type BaseService ¶
type BaseService struct { Base CommonModel BusinessProfile string `json:"business_profile"` Services []*Service `gorm:"ForeignKey:base_service;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
func (BaseService) TableName ¶
func (BaseService) TableName() string
type BusinessPartner ¶
type BusinessPartner struct { Base Name string `gorm:"column:name"` Logo string `gorm:"column:logo"` PartnerID *string `gorm:"column:partner_id"` }
BusinessPartner models a business partner
func (BusinessPartner) TableName ¶
func (BusinessPartner) TableName() string
type BusinessProfile ¶
type BusinessProfile struct { Base Name string `gorm:"column:name"` Logo string `gorm:"column:logo"` Description string `gorm:"column:description"` IntroStatement string `gorm:"column:intro_statement"` Mission string `gorm:"column:mission"` Vision string `gorm:"column:vision"` Slogan string `gorm:"column:slogan"` PhoneNumber string `gorm:"column:phone_number"` Email string `gorm:"column:email"` Facebook string `gorm:"column:facebook"` X string `gorm:"column:x"` Instagram string `gorm:"column:instagram"` TikTok string `gorm:"column:tiktok"` WhatsApp string `gorm:"column:whats_app"` LinkedIn string `gorm:"column:linkedin"` PostalAddress string `gorm:"column:postal_address"` City string `gorm:"column:city"` Country string `gorm:"column:country"` Building string `gorm:"column:building"` FloorNumber string `gorm:"column:floor_number"` Partner *Partner `gorm:"ForeignKey:business_profile;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Services *BaseService `gorm:"ForeignKey:business_profile;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Commitment *Commitment `gorm:"ForeignKey:business_profile;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
func (BusinessProfile) TableName ¶
func (BusinessProfile) TableName() string
type Commitment ¶
type Commitment struct { Base CommonModel BusinessProfile string `json:"business_profile"` WhyUs []*WhyUs `gorm:"ForeignKey:commitment;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
func (Commitment) TableName ¶
func (Commitment) TableName() string
type CommonModel ¶
type Content ¶
type Content struct { Base Title string `gorm:"column:title"` Description string `gorm:"column:description"` Body string `gorm:"column:body"` HeroImage string `gorm:"column:hero_image"` GalleryImages pq.StringArray `gorm:"type:text[];column:gallery_images"` Category string `gorm:"column:category"` Tags pq.StringArray `gorm:"type:text[];column:tags"` ContentType string `gorm:"column:content_type"` Media string `gorm:"column:media"` Price float64 `gorm:"column:price"` Story *string `gorm:"column:story_id"` }
type PGInstance ¶
PGInstance box for postgres client. We use this instead of a global variable
func NewPGInstance ¶
func NewPGInstance() (*PGInstance, error)
NewPGInstance creates a new instance of postgres client
func (*PGInstance) CreateUser ¶
CreateUser create a new user
type Partner ¶
type Partner struct { Base CommonModel BusinessProfile string `json:"business_profile"` BusinessPartners []*BusinessPartner `gorm:"ForeignKey:PartnerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
type Service ¶
type Service struct { Base Title string `gorm:"title"` Description string `gorm:"description"` BaseService *string `gorm:"base_service"` }
Service models the available services
type Story ¶
type Story struct { Base CommonModel BusinessProfile string `json:"business_profile"` Content []*Content `gorm:"ForeignKey:story_id;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
type User ¶
type UserCredentials ¶
type UserCredentials struct { Base ValidFrom time.Time `gorm:"column:valid_from"` ValidTo time.Time `gorm:"column:valid_to"` HashedPin string `gorm:"column:hashed_pin"` Salt string `gorm:"column:salt"` UserID *string `gorm:"column:user_id"` }
func (UserCredentials) TableName ¶
func (UserCredentials) TableName() string
Click to show internal directories.
Click to hide internal directories.