// Assign assign form values back to the template data.
969823
func Assign(form interface{}, data map[string]interface{}) {
	typ := reflect.TypeOf(form)
	val := reflect.ValueOf(form)

	if typ.Kind() == reflect.Ptr {
		typ = typ.Elem()
		val = val.Elem()
	}

	for i := 0; i < typ.NumField(); i++ {
		field := typ.Field(i)

		fieldName := field.Tag.Get("form")
		// Allow ignored fields in the struct
		if fieldName == "-" {
			continue
		} else if len(fieldName) == 0 {
			fieldName = com.ToSnakeCase(field.Name)
		}

		data[fieldName] = val.Field(i).Interface()
	}
}
984124
func assignUpdatingAttributesCallback(scope *Scope) {
	if attrs, ok := scope.InstanceGet("gorm:update_interface"); ok {
		if updateMaps, hasUpdate := scope.updatedAttrsWithValues(attrs); hasUpdate {
			scope.InstanceSet("gorm:update_attrs", updateMaps)
		} else {
			scope.SkipLeft()
		}
	}
}
763205
func (f *Form) Input(name, value string) error {
	if _, ok := f.fields[name]; ok {
		f.fields.Set(name, value)
		return nil
	}
	return errors.NewElementNotFound("No input found with name '%s'.", name)
}
660178
func (a *decimal) Assign(v uint64) {
	var buf [24]byte

	// Write reversed decimal in buf.
	n := 0
	for v > 0 {
		v1 := v / 10
		v -= 10 * v1
		buf[n] = byte(v + '0')
		n++
		v = v1
	}

	// Reverse again to produce forward decimal in a.d.
	a.nd = 0
	for n--; n >= 0; n-- {
		a.d[a.nd] = buf[n]
		a.nd++
	}
	a.dp = a.nd
	trim(a)
}
286431
func (c *Strings) Set(value string) error {
	*c = append(*c, value)
	return nil
}
150696
func (r Render) Add(name string, tmpl *template.Template) {
	if tmpl == nil {
		panic("template can not be nil")
	}
	if len(name) == 0 {
		panic("template name cannot be empty")
	}
	if _, ok := r[name]; ok {
		panic(fmt.Sprintf("template %s already exists", name))
	}
	r[name] = tmpl
}
517185
func (form FormImpl) Initialize(ws *websocket.Conn) Form {
	log.Println("FormImpl Initialize")
	return form
}
1146564
func (st *Static) Attach(tmpl *template.Template) {
	tmpl.Funcs(st.FuncMap())
}
1099293
func (b *Builder) Assign(replica, partition int, node *BuilderNode) {
	b.ring.ReplicaToPartitionToNode[replica][partition] = lowring.Node(node.index)
	b.ring.ReplicaToPartitionToWait[replica][partition] = 0
}
1160038
func (g *Generation) AssignUnit(unitName string) error {
	appName, err := names.UnitApplication(unitName)
	if err != nil {
		return errors.Trace(err)
	}

	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			if err := g.Refresh(); err != nil {
				return nil, errors.Trace(err)
			}
		}
		if err := g.CheckNotComplete(); err != nil {
			return nil, errors.Trace(err)
		}
		if set.NewStrings(g.doc.AssignedUnits[appName]...).Contains(unitName) {
			return nil, jujutxn.ErrNoOperations
		}
		unit, err := g.st.Unit(unitName)
		if err != nil {
			return nil, errors.Trace(err)
		}
		return assignGenerationUnitTxnOps(g.doc.DocId, appName, unit), nil
	}

	return errors.Trace(g.st.db().Run(buildTxn))
}
212096
func (m *matcher) add(filter string, template *Template) {
	if filter == "" {
		m.defaultTemplate = template
		m.root.separator = template.separator
		return
	}
	m.root.insert(filter, template)
}
28861
func (fcomp *fcomp) assign(pos syntax.Position, lhs syntax.Expr) {
	switch lhs := lhs.(type) {
	case *syntax.ParenExpr:
		// (lhs) = rhs
		fcomp.assign(pos, lhs.X)

	case *syntax.Ident:
		// x = rhs
		fcomp.set(lhs)

	case *syntax.TupleExpr:
		// x, y = rhs
		fcomp.assignSequence(pos, lhs.List)

	case *syntax.ListExpr:
		// [x, y] = rhs
		fcomp.assignSequence(pos, lhs.List)

	case *syntax.IndexExpr:
		// x[y] = rhs
		fcomp.expr(lhs.X)
		fcomp.emit(EXCH)
		fcomp.expr(lhs.Y)
		fcomp.emit(EXCH)
		fcomp.setPos(lhs.Lbrack)
		fcomp.emit(SETINDEX)

	case *syntax.DotExpr:
		// x.f = rhs
		fcomp.expr(lhs.X)
		fcomp.emit(EXCH)
		fcomp.setPos(lhs.Dot)
		fcomp.emit1(SETFIELD, fcomp.pcomp.nameIndex(lhs.Name.Name))

	default:
		panic(lhs)
	}
}
166216
func (t *TemplateGroupSet) Insert(g TemplateGroup) error {
	if _, found := t.elements[g.Name]; found {
		return fmt.Errorf("Another template group with the name “%s” is already registered", g.Name)
	}

	t.elements[g.Name] = &g
	return nil
}
940482
func assign(field, value reflect.Value) {
	value = reflect.Indirect(value)

	if field.Kind() == reflect.Ptr {
		// initialize pointer so it's value
		// can be set by assignValue
		field.Set(reflect.New(field.Type().Elem()))
		field = field.Elem()

	}

	assignValue(field, value)
}
594766
func (c *Consumer) Assignment() (partitions []TopicPartition, err error) {
	var cParts *C.rd_kafka_topic_partition_list_t

	cErr := C.rd_kafka_assignment(c.handle.rk, &cParts)
	if cErr != C.RD_KAFKA_RESP_ERR_NO_ERROR {
		return nil, newError(cErr)
	}
	defer C.rd_kafka_topic_partition_list_destroy(cParts)

	partitions = newTopicPartitionsFromCparts(cParts)

	return partitions, nil
}
803109
func (g *Graph) assign(p *Graph, v interface{}, op int) interface{} {

	if op == '=' {
		return g.set(p, v)
	}

	// if p doesn't exist, just set it to the value given
	left, _ := g.getPath(p)
	if left != nil {
		return g.set(p, calc(left.Out[0].This, v, op))
	}

	switch op {
	case '+':
		return g.set(p, v)
	case '-':
		return g.set(p, calc(0, v, '-'))
	case '*':
		return g.set(p, 0)
	case '/':
		return g.set(p, "infinity")
	case '%':
		return g.set(p, "undefined")
	}

	return nil
}
665024
func (a API) AssignUnits(tags []names.UnitTag) ([]error, error) {
	entities := make([]params.Entity, len(tags))
	for i, tag := range tags {
		entities[i] = params.Entity{Tag: tag.String()}
	}
	args := params.Entities{Entities: entities}
	var result params.ErrorResults
	if err := a.facade.FacadeCall("AssignUnits", args, &result); err != nil {
		return nil, err
	}

	errs := make([]error, len(result.Results))
	for i, e := range result.Results {
		if e.Error != nil {
			errs[i] = convertNotFound(e.Error)
		}
	}
	return errs, nil
}