func SpawnChildProcesses() { processes = utils.NewConcurrentMap() // Config JSON child_conf := config.Config{} deepcopier.Copy(&config.SharedConfig).To(&child_conf) child_conf.ChildProcesses = 0 child_conf.MaxProcs = 1 child_conf.IsChild = true for i := 0; i < config.SharedConfig.ChildProcesses; i++ { if child_conf.ReusePort == false { child_conf.ServerPort = config.SharedConfig.ServerPort + i } child_conf.ChildProcessId = strconv.Itoa(i) child_conf_json, _ := json.Marshal(child_conf) args := string(child_conf_json) go spawnChildProcess(i, config.SharedConfig.BinaryPath, args) } WaitForExit() }
func main() { user := &User{ Name: "gilles", } resource := &UserResource{} deepcopier.Copy(user).To(resource) fmt.Println(resource.DisplayName) }
func (a *Accounts) Detail(w rest.ResponseWriter, r *rest.Request) { account := &Account{} result := a.Db.First(&account, "username = ?", r.PathParam("username")) if result.RecordNotFound() { rest.NotFound(w, r) return } resource := &AccountResource{} context := map[string]interface{}{"base_url": r.BaseUrl()} deepcopier.Copy(account).WithContext(context).To(resource) w.WriteJson(&resource) }