models

package
v0.0.0-...-fb4321b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Database *gorm.DB

Functions

func AutoMigrateModels

func AutoMigrateModels()

func DeleteCompany

func DeleteCompany(id string) error

Deletes a company from the database

func DeleteStartup

func DeleteStartup(id string) error

Deletes a startup from the database

func FetchAllCompanies

func FetchAllCompanies() (*[]Company, error)

Fetches all companies from the database

func FetchAllStartups

func FetchAllStartups() (*[]Startup, error)

Fetches all startups from the database

func OpenDatabaseConnection

func OpenDatabaseConnection()

Types

type Company

type Company struct {
	gorm.Model
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	LogoURL     string      `json:"logo_url"`
	WebsiteURL  string      `json:"website_url"`
	SocialMedia SocialMedia `json:"social_media"  gorm:"embedded"`
	Slogan      string      `json:"slogan"`
	Industry    string      `json:"industry"`
	CEO         string      `json:"ceo"`
	Since       string      `json:"since"`
	Headquater  Office      `json:"headquarter" gorm:"embedded"`
}

func FetchCompany

func FetchCompany(id string) (*Company, error)

Fetches a company from the database

func (*Company) Save

func (company *Company) Save() (*Company, error)

Saves a company to the database

func (*Company) UpdateCompany

func (company *Company) UpdateCompany(id string) (*Company, error)

Updates a company in the database

type Founder

type Founder struct {
	gorm.Model
	Name       string `json:"name" bson:"name"`
	Profession string `json:"profession" bson:"profession"`
	Age        int    `json:"age" bson:"age"`
}

type Office

type Office struct {
	gorm.Model
	Country string `json:"country"`
	Town    string `json:"town"`
	Venue   string `json:"venue"`
}

type SocialMedia

type SocialMedia struct {
	Facebook  string `json:"facebook"`
	Whatsapp  string `json:"whatsapp"`
	X         string `json:"x"`
	LinkedIn  string `json:"linkedin"`
	Instagram string `json:"instagram"`
}

type Startup

type Startup struct {
	gorm.Model
	Name             string  `json:"name" bson:"name"`
	CEO              string  `json:"ceo" bson:"ceo"`
	ValueProposition string  `json:"value_proposition" bson:"value_proposition"`
	Industry         string  `json:"industry" bson:"industry"`
	Founder          Founder `json:"founder" bson:"founder" gorm:"embedded"`
}

func FetchStartup

func FetchStartup(id string) (*Startup, error)

Fetches a startup from the database

func (*Startup) Save

func (startup *Startup) Save() (*Startup, error)

Saves a startup to the database

func (*Startup) UpdateStartup

func (startup *Startup) UpdateStartup(id string) (*Startup, error)

Updates a startup in the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL