client

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteClient added in v1.0.0

func DeleteClient(id primitive.ObjectID) error

Delete client from DB

func ModifyClient added in v1.0.0

func ModifyClient(id primitive.ObjectID, nc Client) error

modify client in DB

func SaveClient added in v1.0.0

func SaveClient(c Client) (primitive.ObjectID, error)

Add client to db

Types

type Address

type Address struct {
	/* "Text" means the actual address lines.
	 * If address is 123, xyz colony, myCity, myState the Text
	 * will be 123, xyz colony, and
	 * State and City will be myCity and myState
	 *
	 * A multiline string is expected.
	 */
	Text       string `bson:"Text" json:"Text"`
	City       string `bson:"City" json:"City"`
	State      string `bson:"State" json:"State"`
	PostalCode string `bson:"PostalCode" json:"PostalCode"`
	Country    string `bson:"Country" json:"Country"`
}

type Client

type Client struct {
	Id      primitive.ObjectID `bson:"_id,omitempty" json:"Id"`
	Name    string             `bson:"Name" json:"Name"`
	Contact Contact            `bson:"Contact" json:"Contact"`
	GSTIN   string             `bson:"GSTIN" json:"GSTIN"`
	/* if shipping address is empty it means that
	 * the billing address is also shipping address
	 */
	BillingAddress    Address   `bson:"BillingAddress" json:"BillingAddress"`
	ShippingAddresses []Address `bson:"ShippingAddresses,omitempty" json:"ShippingAddresses"`
}

func GetClients added in v0.0.2

func GetClients(filter bson.M) ([]Client, error)

GetClients queries the database and * returns clients based on the given filter * if filter is nil every client is returned

type Contact

type Contact struct {
	Name    string   `bson:"Name" json:"Name"`
	Phones  []string `bson:"Phones" json:"Phones"`
	Emails  []string `bson:"Emails" json:"Emails"`
	Website string   `bson:"Website" json:"Website"`
}

Jump to

Keyboard shortcuts

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