domain

package
v0.0.0-...-4362469 Latest Latest
Warning

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

Go to latest
Published: May 8, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Gdb *gorm.DB
)
View Source
var RecordAlreadyExistError error = errors.New("domain: create new record failed, this record already exist.")
View Source
var RecordNotFoundError error = errors.New("domain: record not found in DB.")

Functions

func UpdateCreateDate

func UpdateCreateDate(domain interface{}) error

Types

type Bus

type Bus struct {
	Domain
	BusLicense      string
	CustomId        string
	RegisterDate    time.Time
	VehicleIDNumber string `gorm:"column:VIN"`
	EngineNo        string
	PersonsCapacity int
	BrandID         string
	BusBrand        BusBrand `gorm:"save_associations:false"`
}

func (*Bus) BeforeCreate

func (*Bus) BeforeCreate(scope *gorm.Scope) error

func (*Bus) Create

func (bus *Bus) Create() error

func (Bus) QueryAll

func (bus Bus) QueryAll() []Bus

func (*Bus) QueryByLicense

func (bus *Bus) QueryByLicense() error

func (Bus) TableName

func (Bus) TableName() string

func (*Bus) Update

func (bus *Bus) Update() error

type BusBrand

type BusBrand struct {
	Domain
	Name  string
	Model string
	Alias string
}

func (*BusBrand) BeforeCreate

func (*BusBrand) BeforeCreate(scope *gorm.Scope) error

func (*BusBrand) Create

func (busBrand *BusBrand) Create() error

func (BusBrand) QueryAll

func (busBrand BusBrand) QueryAll() []BusBrand

type ChargeRecord

type ChargeRecord struct {
	Domain
	RecordStaffID string
	RecordStaff   Staff
	BusID         string
	Bus           Bus
	RecordDate    time.Time
	Mileage       float32
	ChargedTWH    float32 `gorm:"column:charged_TWH"`
	RemainPercent float32
	FinalPercent  float32
}

func (*ChargeRecord) BeforeCreate

func (*ChargeRecord) BeforeCreate(scope *gorm.Scope) error

func (*ChargeRecord) Create

func (chargeRecord *ChargeRecord) Create() error

func (ChargeRecord) Query

func (ChargeRecord) Query(query map[string]interface{}) []ChargeRecord

func (ChargeRecord) QueryAll

func (ChargeRecord) QueryAll() []ChargeRecord

func (*ChargeRecord) QueryByID

func (chargeRecord *ChargeRecord) QueryByID() error

func (*ChargeRecord) Update

func (chargeRecord *ChargeRecord) Update() error

type Department

type Department Dictionary

func (*Department) Create

func (department *Department) Create() error

func (Department) QueryAll

func (Department) QueryAll() []Department

func (Department) TableName

func (Department) TableName() string

func (*Department) Update

func (department *Department) Update() error

type Dictionary

type Dictionary struct {
	Domain
	Name     string
	Type     int
	IsActive bool
}

func (*Dictionary) BeforeCreate

func (*Dictionary) BeforeCreate(scope *gorm.Scope) error

func (Dictionary) Query

func (Dictionary) Query(query map[string]interface{}) []Dictionary

func (*Dictionary) QueryUnique

func (dic *Dictionary) QueryUnique() error

type Domain

type Domain struct {
	ID        string `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

type DriverType

type DriverType Dictionary

func (*DriverType) Create

func (driverType *DriverType) Create() error

func (DriverType) QueryAll

func (DriverType) QueryAll() []DriverType

func (DriverType) TableName

func (DriverType) TableName() string

func (*DriverType) Update

func (driverType *DriverType) Update() error

type JobType

type JobType Dictionary

func (*JobType) Create

func (jobType *JobType) Create() error

func (JobType) QueryAll

func (JobType) QueryAll() []JobType

func (JobType) TableName

func (JobType) TableName() string

func (*JobType) Update

func (jobType *JobType) Update() error

type LineFareIncome

type LineFareIncome struct {
	Domain
	LineNo           int
	CarryingAmount   float32
	ActualAmount     float32
	WornCoinAmount   float32
	BusNumbers       int
	CountingDate     time.Time
	CountingStaff1ID string `gorm:"ForeignKey:CountingStaff1ID"`
	CountingStaff1   Staff
	CountingStaff2ID string `gorm:"ForeignKey:CountingStaff2ID"`
	CountingStaff2   Staff
	RecordStaffID    string
	RecordStaff      Staff `gorm:"ForeignKey:RecordStaffID"`
}

func (*LineFareIncome) BeforeCreate

func (*LineFareIncome) BeforeCreate(scope *gorm.Scope) error

func (*LineFareIncome) Create

func (fareIncome *LineFareIncome) Create() error

func (LineFareIncome) Query

func (LineFareIncome) Query(query map[string]interface{}) []LineFareIncome

func (LineFareIncome) QueryAll

func (fareIncome LineFareIncome) QueryAll() []LineFareIncome

func (*LineFareIncome) Update

func (fareIncome *LineFareIncome) Update() error

type Staff

type Staff struct {
	Domain
	Name                     string
	JobTypeID                string
	JobType                  JobType `gorm:"ForeignKey:JobTypeID"`
	OnboardTime              time.Time
	PersonalID               string
	DriverTypeID             string
	DriverType               DriverType `gorm:"ForeignKey:DriverTypeID"`
	IsInternship             bool
	IsMultitimeHired         bool
	IsResign                 bool
	FirstOnboardTime         time.Time
	Phone                    string
	DepartmentID             string
	Department               Department `gorm:"ForeignKey:DepartmentID"`
	EmergencyContact         string
	EmergencyContactPhone    string
	EmergencyContactRelation string
}

func (*Staff) BeforeCreate

func (*Staff) BeforeCreate(scope *gorm.Scope) error

func (*Staff) Create

func (staff *Staff) Create() error

func (Staff) IsQualified

func (staff Staff) IsQualified() (result bool)

func (Staff) NeedUpgrade

func (staff Staff) NeedUpgrade() (result bool)

func (Staff) Query

func (Staff) Query(query map[string]interface{}, isNot bool) []Staff

func (Staff) QueryByJoin

func (staff Staff) QueryByJoin(joins, conditions []string) []Staff

func (*Staff) QueryUnique

func (staff *Staff) QueryUnique() error

func (Staff) String

func (staff Staff) String() string

func (*Staff) Update

func (staff *Staff) Update() error

func (*Staff) UpdateToResign

func (staff *Staff) UpdateToResign() error

type StaffResign

type StaffResign struct {
	Domain
	StaffID      string `gorm:"ForeignKey:staff_id"`
	Staff        Staff
	ResignDate   time.Time
	ResignReason string
}

func (*StaffResign) BeforeCreate

func (*StaffResign) BeforeCreate(scope *gorm.Scope) error

func (*StaffResign) Create

func (staffResign *StaffResign) Create() error

func (StaffResign) Query

func (StaffResign) Query(query map[string]interface{}) []StaffResign

func (StaffResign) QueryAll

func (staffResign StaffResign) QueryAll() []StaffResign

func (*StaffResign) Update

func (staffResign *StaffResign) Update() error

Jump to

Keyboard shortcuts

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