models

package
v0.0.0-...-26a0239 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOneCustomer

func DeleteOneCustomer(
	ctx context.Context,
	db *mongo.Database,
	customerId primitive.ObjectID,
) (*mongo.DeleteResult, error)

func DeleteOneOwnedCompany

func DeleteOneOwnedCompany(
	ctx context.Context,
	db *mongo.Database,
	ownerID primitive.ObjectID,
	companyID primitive.ObjectID,
) (*mongo.UpdateResult, error)

func DeleteOneOwner

func DeleteOneOwner(
	ctx context.Context,
	db *mongo.Database,
	ownerID primitive.ObjectID,
) (*mongo.DeleteResult, error)

func FindOneCustomer

func FindOneCustomer(
	ctx context.Context,
	db *mongo.Database,
	customerID primitive.ObjectID,
) *mongo.SingleResult

func FindOneCustomerCredentials

func FindOneCustomerCredentials(
	ctx context.Context,
	db *mongo.Database,
	mail string,
) *mongo.SingleResult

func FindOneOwner

func FindOneOwner(
	ctx context.Context,
	db *mongo.Database,
	ownerID primitive.ObjectID,
) *mongo.SingleResult

func FindOneOwnerCredentials

func FindOneOwnerCredentials(
	ctx context.Context,
	db *mongo.Database,
	mail string,
) *mongo.SingleResult

func InsertOneOwnedCompany

func InsertOneOwnedCompany(
	ctx context.Context,
	db *mongo.Database,
	ownerID primitive.ObjectID,
	companyID primitive.ObjectID,
) (*mongo.UpdateResult, error)

Types

type Customer

type Customer struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	Mail      string             `bson:"mail,omitempty"`
	HashedPwd string             `bson:"pwd,omitempty"`
	Name      string             `bson:"name,omitempty"`
	Surname   string             `bson:"surname,omitempty"`
}

func (*Customer) InsertOne

func (customer *Customer) InsertOne(
	ctx context.Context,
	db *mongo.Database,
) (*mongo.InsertOneResult, error)

type CustomerUpdate

type CustomerUpdate struct {
	Mail      *string `bson:"mail,omitempty"`
	HashedPwd *string `bson:"pwd,omitempty"`
	Name      *string `bson:"name,omitempty"`
	Surname   *string `bson:"surname,omitempty"`
}

func (*CustomerUpdate) UpdateOne

func (customerUpdate *CustomerUpdate) UpdateOne(
	ctx context.Context,
	db *mongo.Database,
	customerID primitive.ObjectID,
) (*mongo.UpdateResult, error)

type Owner

type Owner struct {
	ID        primitive.ObjectID   `bson:"_id,omitempty"`
	Mail      string               `bson:"mail,omitempty"`
	HashedPwd string               `bson:"pwd,omitempty"`
	Name      string               `bson:"name,omitempty"`
	Surname   string               `bson:"surname,omitempty"`
	Companies []primitive.ObjectID `bson:"companies,omitempty"`
}

func (*Owner) InsertOne

func (owner *Owner) InsertOne(
	ctx context.Context,
	db *mongo.Database,
) (*mongo.InsertOneResult, error)

type OwnerUpdate

type OwnerUpdate struct {
	Mail      *string `bson:"mail,omitempty"`
	HashedPwd *string `bson:"pwd,omitempty"`
	Name      *string `bson:"name,omitempty"`
	Surname   *string `bson:"surname,omitempty"`
}

func (*OwnerUpdate) UpdateOne

func (ownerUpdate *OwnerUpdate) UpdateOne(
	ctx context.Context,
	db *mongo.Database,
	ownerId primitive.ObjectID,
) (*mongo.UpdateResult, error)

Jump to

Keyboard shortcuts

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