cmd

package
v0.0.0-...-b161460 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpDepartments

func DumpDepartments(id int) (Department, []Department)

func DumpEmployee

func DumpEmployee(id int, ch chan Employee, titles []Title, salaries []Salary, current Department, history []Department)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetManagerTitle

func GetManagerTitle(deptManagers []Department, from time.Time, to time.Time) bool

func InitIds

func InitIds() ([]int, error)

func InsertMany

func InsertMany(chunk []Employee, ch chan int)

func MakeChunks

func MakeChunks(employees []Employee) [][]Employee

func ToJson

func ToJson(emps []Employee)

Types

type Department

type Department struct {
	Number string    `json:"dept_no" bson:"dept_no"`
	Name   string    `json:"dept_name" bson:"dept_name"`
	From   time.Time `json:"from_date" bson:"from_date"`
	To     time.Time `json:"to_date,omitempty" bson:"to_date,omitempty"`
}

func DumpDeptManager

func DumpDeptManager(id int) []Department

type Employee

type Employee struct {
	EmpNo       int          `json:"emp_no" bson:"emp_no"`
	BirthDate   time.Time    `json:"birth_date" bson:"birth_date"`
	FirstName   string       `json:"first_name" bson:"first_name"`
	LastName    string       `json:"last_name" bson:"last_name"`
	Gender      string       `json:"gender" bson:"gender"`
	HireDate    time.Time    `json:"hire_date" bson:"hire_date"`
	Titles      []Title      `json:"titles" bson:"titles"`
	Salaries    []Salary     `json:"salaries" bson:"salaries"`
	DeptCurrent Department   `json:"current_dept" bson:"current_dept"`
	DeptHistory []Department `json:"dept_history,omitempty" bson:"dept_history"`
}

type Salary

type Salary struct {
	Amount int       `json:"amount" bson:"amount"`
	From   time.Time `json:"from_date" bson:"from_date"`
	To     time.Time `json:"to_date" bson:"to_date"`
}

func DumpSalaries

func DumpSalaries(id int) []Salary

type Title

type Title struct {
	Name      string    `json:"name" bson:"name"`
	From      time.Time `json:"from_date" bson:"from_date"`
	To        time.Time `json:"to_date" bson:"to_date"`
	IsManager bool      `json:"is_manager" bson:"is_manager"`
}

func DumpTitles

func DumpTitles(id int, deptManagers []Department) []Title

Jump to

Keyboard shortcuts

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