models

package
v0.0.0-...-8f801f6 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDbConnection

func CloseDbConnection(db *sql.DB)

CloseDbConnection will end dialogue with the DB Recommanded to use at program's end

func ConnectToDB

func ConnectToDB(host string, dbname string, user string, password string, port int64)

ConnectToDB Set up connection to the postgres DB Will panic on error

func CreateCampaignAndMailingList

func CreateCampaignAndMailingList(mailingListName string, campaignName string, businessID string) (MailingList, Campaign, error)

CreateCampaignAndMailingList will add a new Campaign and a new mailingList to the DB

func GetMailingList

func GetMailingList(mailingListID string, c *gin.Context) (MailingList, []Customer, error)

GetMailingList will get information from a mailingList and it's customers

func UnlinkCustomerMailingList

func UnlinkCustomerMailingList(customerID string, mailingListID string) error

UnlinkCustomerMailingList will remove a customer from a mailing list

func VerifyUserCredentials

func VerifyUserCredentials(email string, password string) (bool, error)

VerifyUserCredentials will fetch user's password and compare it with the one entered Recommanded to use at program's end

Types

type Business

type Business struct {
	BusinessID int
	Name       string
}

Business represent the business type

func CreateBusiness

func CreateBusiness(businessName string) (Business, error)

CreateBusiness will add a new business to the DB

func GetBusiness

func GetBusiness(businessID string) (Business, error)

GetBusiness will return a business from it's ID from the DB

func GetBusinessByName

func GetBusinessByName(businessName string) (Business, error)

GetBusinessByName will return a business from it's ID from the DB

type Campaign

type Campaign struct {
	CampaignID    int
	Name          string
	MailingListID int
	BusinessID    int
}

Campaign Represents a mail campaign

func CreateCampaignWithExistingMailingList

func CreateCampaignWithExistingMailingList(campaignName string, mailingListID string, businessID string) (Campaign, error)

CreateCampaignWithExistingMailingList will add a new Campaign to the DB with an existing mailingList

func GetBusinessCampaigns

func GetBusinessCampaigns(businessID string, c *gin.Context) ([]Campaign, error)

GetBusinessCampaigns will get all campaigns from a business

func GetCampaign

func GetCampaign(campaignID string) (Campaign, error)

GetCampaign will add a get information from a campaign

type Customer

type Customer struct {
	CustomerID int
	Email      string
	Name       string
	Surname    string
	BusinessID int
}

Customer type

func CreateAndLinkCustomer

func CreateAndLinkCustomer(email string, name string, surname string, businessID string, mailingListID string) (Customer, error)

CreateAndLinkCustomer will add a new customer and link it to a mailing list in the DB

func CreateCustomer

func CreateCustomer(email string, name string, surname string, businessID string) (Customer, error)

CreateCustomer will add a new customer to the DB

func GetCustomer

func GetCustomer(customerID string) (Customer, error)

GetCustomer will get a customer from the DB

type MailingList

type MailingList struct {
	MailintListID int
	Name          string
	BusinessID    int
}

MailingList type

func CreateMailingList

func CreateMailingList(mailingListName string, businessID string) (MailingList, error)

CreateMailingList will add a new mailingList to the DB

type MailingListCustomerLink struct {
	MailintListID int
	CustomerID    int
}

MailingListCustomerLink type

type SavedUser

type SavedUser struct {
	UserID     int
	Email      string
	Password   []byte
	BusinessID int
}

SavedUser represent the user's type after they are saved in the DB

func CreateUser

func CreateUser(email string, password string, businessID string) (SavedUser, error)

CreateUser will add a new user to the DB

func GetUser

func GetUser(email string, getPassword bool) (SavedUser, error)

GetUser will return a user from the DB

type UnSavedUser

type UnSavedUser struct {
	UserID     int
	Email      string
	Password   string
	BusinessID int
}

UnSavedUser represent the user's type before they are saved in the DB

Jump to

Keyboard shortcuts

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