model

package
v0.0.0-...-a812556 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Apiary

type Apiary struct {
	Db       *sqlx.DB
	ID       int     `json:"id"`
	UserID   string  `json:"user_id" db:"user_id"`
	Name     *string `json:"name"`
	Location *string `json:"location"`
	Active   *bool   `json:"active" db:"active"`
	Lat      *string `json:"lat" db:"lat"`
	Lng      *string `json:"lng" db:"lng"`
}

func (*Apiary) Create

func (r *Apiary) Create(input ApiaryInput) (*Apiary, error)

func (*Apiary) Deactivate

func (r *Apiary) Deactivate(id string) (*bool, error)

func (*Apiary) Get

func (r *Apiary) Get(id string) (*Apiary, error)

func (Apiary) IsEntity

func (Apiary) IsEntity()

func (*Apiary) List

func (r *Apiary) List() ([]*Apiary, error)

func (*Apiary) Update

func (r *Apiary) Update(id string, input ApiaryInput) (*Apiary, error)

type ApiaryInput

type ApiaryInput struct {
	Name string  `json:"name"`
	Lat  *string `json:"lat"`
	Lng  *string `json:"lng"`
}

type Box

type Box struct {
	Db       *sqlx.DB
	ID       *string `json:"id"`
	UserID   string  `db:"user_id"`
	HiveId   int     `json:"hive_id" db:"hive_id"`
	Position *int    `json:"position"`
	Color    *string `json:"color"`
	Type     BoxType `json:"type" db:"type"`
	Active   int     `db:"active"`
}

func (*Box) Count

func (r *Box) Count(hiveId string) (int, error)

func (*Box) Create

func (r *Box) Create(hiveId string, position int, color *string, boxType BoxType) (*string, error)

func (*Box) CreateByHiveId

func (r *Box) CreateByHiveId(hiveId string, boxCount int, colors []*string) error

func (*Box) Deactivate

func (r *Box) Deactivate(id string) (*bool, error)

func (*Box) Get

func (r *Box) Get(id string) (*Box, error)

func (*Box) ListByHive

func (r *Box) ListByHive(hiveId string) ([]*Box, error)

func (*Box) SwapBoxPositions

func (r *Box) SwapBoxPositions(box1ID string, box2ID string) (*bool, error)

func (*Box) Update

func (r *Box) Update(id *string, position int, color *string) (bool, error)

type BoxInput

type BoxInput struct {
	ID       *string `json:"id"`
	Position int     `json:"position"`
	Color    *string `json:"color"`
	Type     BoxType `json:"type"`
	// ignored, added for frontend ease
	HiveID *int         `json:"hiveId"`
	Family *FamilyInput `json:"family"`
}

type BoxType

type BoxType string
const (
	BoxTypeDeep             BoxType = "DEEP"
	BoxTypeSuper            BoxType = "SUPER"
	BoxTypeGate             BoxType = "GATE"
	BoxTypeVentilation      BoxType = "VENTILATION"
	BoxTypeQueenExcluder    BoxType = "QUEEN_EXCLUDER"
	BoxTypeHorizontalFeeder BoxType = "HORIZONTAL_FEEDER"
)

func (BoxType) IsValid

func (e BoxType) IsValid() bool

func (BoxType) MarshalGQL

func (e BoxType) MarshalGQL(w io.Writer)

func (BoxType) String

func (e BoxType) String() string

func (*BoxType) UnmarshalGQL

func (e *BoxType) UnmarshalGQL(v interface{}) error

type Family

type Family struct {
	Db          *sqlx.DB
	UserID      string        `db:"user_id"`
	ID          string        `json:"id"  db:"id"`
	Race        *string       `json:"race" db:"race"`
	Age         *int          `json:"age"`
	Added       *string       `json:"added" db:"added"`
	Inspections []*Inspection `json:"inspections"`
}

func (*Family) Create

func (r *Family) Create(race *string, added *string) (*int, error)

func (*Family) GetById

func (r *Family) GetById(id *int) (*Family, error)

func (*Family) Update

func (r *Family) Update(id *string, race *string, added *string) (*int64, error)

func (*Family) Upsert

func (r *Family) Upsert(uid string, hive HiveUpdateInput) (*string, error)

type FamilyInput

type FamilyInput struct {
	ID    *string `json:"id"`
	Race  *string `json:"race"`
	Added *string `json:"added"`
}

type Frame

type Frame struct {
	Db        *sqlx.DB
	ID        int        `json:"id"`
	UserID    string     `db:"user_id"`
	BoxId     int        `db:"box_id"`
	Position  int        `json:"position"`
	Type      FrameType  `json:"type" db:"type"`
	LeftID    *int       `json:"left" db:"left_id"`
	RightID   *int       `json:"right" db:"right_id"`
	LeftSide  *FrameSide `json:"left" `
	RightSide *FrameSide `json:"right"`
	Active    int        `db:"active"`
}

func (*Frame) Create

func (r *Frame) Create(boxID *string, position int, frameType FrameType, leftID *int64, rightID *int64) (*int64, error)

func (*Frame) CreateFramesForBox

func (r *Frame) CreateFramesForBox(boxID *string, frameCount int) error

func (*Frame) Deactivate

func (r *Frame) Deactivate(id string) (*bool, error)

func (*Frame) DeactivateFrames

func (r *Frame) DeactivateFrames(boxId *string) error

func (*Frame) Get

func (r *Frame) Get(id int64) (*Frame, error)

func (*Frame) IsFrameWithSides

func (r *Frame) IsFrameWithSides(frameType FrameType) bool

func (*Frame) ListByBox

func (r *Frame) ListByBox(boxId *string) ([]*Frame, error)

func (*Frame) Update

func (r *Frame) Update(frameID string, boxID string, position int) (*int64, error)

type FrameInput

type FrameInput struct {
	ID       string    `json:"id"`
	Position int       `json:"position"`
	Type     FrameType `json:"type"`
	// ignored, added for frontend ease
	BoxID string `json:"boxId"`
	// ignored, added for frontend ease
	HiveID *int `json:"hiveId"`
}

type FrameSide

type FrameSide struct {
	Db     *sqlx.DB
	ID     *string `json:"id" db:"id"`
	UserID string  `db:"user_id"`
}

func (*FrameSide) CreateSide

func (r *FrameSide) CreateSide(frame *FrameSide) (*int64, error)

func (*FrameSide) Get

func (r *FrameSide) Get(id *int) (*FrameSide, error)

func (FrameSide) IsEntity

func (FrameSide) IsEntity()

type FrameType

type FrameType string
const (
	FrameTypeVoid       FrameType = "VOID"
	FrameTypeFoundation FrameType = "FOUNDATION"
	FrameTypeEmptyComb  FrameType = "EMPTY_COMB"
	FrameTypePartition  FrameType = "PARTITION"
	FrameTypeFeeder     FrameType = "FEEDER"
)

func (FrameType) IsValid

func (e FrameType) IsValid() bool

func (FrameType) MarshalGQL

func (e FrameType) MarshalGQL(w io.Writer)

func (FrameType) String

func (e FrameType) String() string

func (*FrameType) UnmarshalGQL

func (e *FrameType) UnmarshalGQL(v interface{}) error

type Hive

type Hive struct {
	Db       *sqlx.DB
	ID       string `json:"id"`
	UserID   string `db:"user_id"`
	ApiaryID int    `db:"apiary_id"`
	FamilyID *int   `db:"family_id"`
	Active   *bool  `db:"active"`

	Name   *string `json:"name"`
	Notes  *string `json:"notes"`
	Note   *string `json:"note"`
	Color  *string `json:"color"`
	Status *string `json:"status"`
	Added  *string `json:"added"`
	Boxes  []*Box  `json:"boxes"`
}

func (*Hive) Create

func (r *Hive) Create(input HiveInput, familyID *int) (*Hive, error)

func (*Hive) Deactivate

func (r *Hive) Deactivate(id string) (*bool, error)

func (*Hive) Get

func (r *Hive) Get(id string) (*Hive, error)

func (Hive) IsEntity

func (Hive) IsEntity()

func (*Hive) List

func (r *Hive) List(userID string) ([]*Hive, error)

func (*Hive) ListByApiary

func (r *Hive) ListByApiary(apiaryId int) ([]*Hive, error)

func (*Hive) Update

func (r *Hive) Update(id string, name *string, notes *string, FamilyID *string) error

type HiveInput

type HiveInput struct {
	ApiaryID   string    `json:"apiaryId"`
	Name       string    `json:"name"`
	BoxCount   int       `json:"boxCount"`
	FrameCount int       `json:"frameCount"`
	Colors     []*string `json:"colors"`
}

type HiveUpdateInput

type HiveUpdateInput struct {
	ID     string       `json:"id"`
	Name   *string      `json:"name"`
	Notes  *string      `json:"notes"`
	Family *FamilyInput `json:"family"`
}

type Inspection

type Inspection struct {
	Db     *sqlx.DB
	ID     string `json:"id" db:"id"`
	UserID string `db:"user_id"`
	HiveID string `json:"hiveId" db:"hive_id"`
	Data   string `json:"data" db:"data"`
	Added  string `json:"added" db:"added"`
}

func (*Inspection) CountByHiveId

func (r *Inspection) CountByHiveId(hiveID string) (int, error)

func (*Inspection) Create

func (r *Inspection) Create(data string, hiveID int) (*string, error)

func (*Inspection) Get

func (r *Inspection) Get(ID string) (*Inspection, error)

func (*Inspection) GetLatestByHiveId

func (r *Inspection) GetLatestByHiveId(hiveID string) (*Inspection, error)

func (*Inspection) ListByHiveId

func (r *Inspection) ListByHiveId(hiveID string) ([]*Inspection, error)

type InspectionInput

type InspectionInput struct {
	HiveID int    `json:"hiveId"`
	Data   string `json:"data"`
}

type Treatment

type Treatment struct {
	Db *sqlx.DB

	ID       int     `json:"id"`
	UserID   string  `json:"user_id" db:"user_id"`
	BoxId    *string `json:"box_id" db:"box_id"`
	HiveId   string  `json:"hive_id" db:"hive_id"`
	FamilyId string  `json:"family_id" db:"family_id"`
	Added    string  `json:"added" db:"added"`
	Type     string  `json:"type" db:"type"`
}

func (*Treatment) Get

func (r *Treatment) Get(id string) (*Treatment, error)

func (*Treatment) GetLastFamilyTreatment

func (r *Treatment) GetLastFamilyTreatment(familyId string) (*Treatment, error)

func (Treatment) IsEntity

func (Treatment) IsEntity()

func (*Treatment) ListFamilyTreatments

func (r *Treatment) ListFamilyTreatments(familyId string) ([]*Treatment, error)

func (*Treatment) TreatHive

func (r *Treatment) TreatHive(input TreatmentOfHiveInput, familyId *int) (*Treatment, error)

func (*Treatment) TreatHiveBox

func (r *Treatment) TreatHiveBox(input TreatmentOfBoxInput, familyId *int) (*Treatment, error)

type TreatmentOfBoxInput

type TreatmentOfBoxInput struct {
	HiveID string `json:"hiveId"`
	BoxID  string `json:"boxId"`
	Type   string `json:"type"`
}

type TreatmentOfHiveInput

type TreatmentOfHiveInput struct {
	HiveID string `json:"hiveId"`
	Type   string `json:"type"`
}

Jump to

Keyboard shortcuts

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