client

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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"`
	City       string `bson:"City"`
	State      string `bson:"State"`
	PostalCode string `bson:"PostalCode"`
	Country    string `bson:"Country"`
}

type Client

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

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

func (Client) Delete

func (c Client) Delete() error

Delete client from DB

func (Client) Modify

func (c Client) Modify(nc Client) error

Modify client in DB * Takes another new client as an argument * and updates accordingly

func (*Client) Save

func (c *Client) Save() error

Add client to db

type Contact

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

Jump to

Keyboard shortcuts

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