models

package
v0.0.0-...-01a8174 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOneCompany

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

func DeleteOneService

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

func FindManyCompanies

func FindManyCompanies(
	ctx context.Context,
	db *mongo.Database,
	startValue primitive.ObjectID,
	nPerPage int64,
) (*mongo.Cursor, error)

func FindManyCompaniesByIds

func FindManyCompaniesByIds(
	ctx context.Context,
	db *mongo.Database,
	companyIDS []primitive.ObjectID,
	startValue primitive.ObjectID,
	nPerPage int64,
) (*mongo.Cursor, error)

func FindManyServices

func FindManyServices(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	startValue primitive.ObjectID,
	nPerPage int64,
) (*mongo.Cursor, error)

func FindOneCompany

func FindOneCompany(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
) *mongo.SingleResult

Types

type Company

type Company struct {
	ID               primitive.ObjectID `bson:"_id,omitempty"`
	Name             string             `bson:"name,omitempty"`
	Type             string             `bson:"type,omitempty"`
	Localisation     string             `bson:"localisation,omitempty"`
	ShortDescription string             `bson:"short_description,omitempty"`
	LongDescription  string             `bson:"long_description,omitempty"`
	Services         []Service          `bson:"services,omitempty"`
}

func (*Company) InsertOne

func (company *Company) InsertOne(
	ctx context.Context,
	db *mongo.Database,
) (*mongo.InsertOneResult, error)

type CompanyUpdate

type CompanyUpdate struct {
	Name             *string   `bson:"name,omitempty"`
	Type             *string   `bson:"type,omitempty"`
	Localisation     *string   `bson:"localisation,omitempty"`
	ShortDescription *string   `bson:"short_description,omitempty"`
	LongDescription  *string   `bson:"long_description,omitempty"`
	Services         []Service `bson:"services,omitempty"`
}

func (*CompanyUpdate) UpdateOne

func (companyUpdate *CompanyUpdate) UpdateOne(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
) (*mongo.UpdateResult, error)

type Service

type Service struct {
	ID          primitive.ObjectID `bson:"service_id,omitempty"`
	Name        string             `bson:"name,omitempty"`
	Price       int32              `bson:"price,omitempty"`
	Duration    int32              `bson:"duration,omitempty"`
	Description string             `bson:"description,omitempty"`
}

func (*Service) InsertOne

func (service *Service) InsertOne(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
) (*mongo.UpdateResult, error)

type ServiceUpdate

type ServiceUpdate struct {
	Name        *string `bson:"name,omitempty"`
	Price       *int32  `bson:"price,omitempty"`
	Duration    *int32  `bson:"duration,omitempty"`
	Description *string `bson:"description,omitempty"`
}

func (*ServiceUpdate) UpdateOne

func (serviceUpdate *ServiceUpdate) UpdateOne(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	serviceID primitive.ObjectID,
) (*mongo.UpdateResult, error)

Jump to

Keyboard shortcuts

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