ui/account.go
func (h *Handler) UpdateAccount(tkn, account, name string,
	isDefault, inUse bool) error {
	logger := h.logger.Add("method", "UpdateAccount",
		"account", account)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return ErrAccessDenied
	}

	acc := data.Account{}
	err := h.findByPrimaryKey(
		logger, ErrAccountNotFound, &acc, account)
	if err != nil {
		return err
	}

	if name != "" {
		acc.Name = name
	}

	acc.IsDefault = isDefault
	acc.InUse = inUse

	return update(logger, h.db.Querier, &acc)
}
func (h *Handler) UpdateAccount(tkn, account, name string,
	isDefault, inUse bool) error {
	logger := h.logger.Add("method", "UpdateAccount",
		"account", account)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return ErrAccessDenied
	}

	acc := data.Account{}
	err := h.findByPrimaryKey(
		logger, ErrAccountNotFound, &acc, account)
	if err != nil {
		return err
	}

	if name != "" {
		acc.Name = name
	}

	acc.IsDefault = isDefault
	acc.InUse = inUse

	return update(logger, h.db.Querier, &acc)
}
func ( h * Handler ) UpdateAccount ( tkn , account , name string , isDefault , inUse bool ) error { logger := h . logger . Add ( " " , " " , " " , account ) if ! h . token . Check ( tkn ) { logger . Warn ( " " ) return ErrAccessDenied } acc := data . Account { } err := h . findByPrimaryKey ( logger , ErrAccountNotFound , & acc , account ) if err != nil { return err } if name != " " { acc . Name = name } acc . IsDefault = isDefault acc . InUse = inUse return update ( logger , h . db . Querier , & acc ) }
// UpdateAccount updates an account.
UpdateAccount updates an account .