Exemple #1
0
func TestGetStructLike(t *testing.T) {
	b := FooBuilder.X(1).Y(2).Add(3).Add(4)
	s := builder.GetStructLike(b, Foo{}).(Foo)
	expected := Foo{X: 1, Y: 2, Add: []int{3, 4}}
	if !reflect.DeepEqual(s, expected) {
		t.Errorf("expected %v, got %v", expected, s)
	}
}
Exemple #2
0
func (b jsonBuilder) BuildReply() Reply {
	return builder.GetStructLike(b, Reply{}).(Reply)
}
Exemple #3
0
func (b jsonBuilder) BuildMessage() Message {
	return builder.GetStructLike(b, Message{}).(Message)
}
Exemple #4
0
func (b jsonBuilder) BuildCustomer() Customer {
	return builder.GetStructLike(b, Customer{}).(Customer)
}
Exemple #5
0
func (b jsonBuilder) AddDomain(value string) jsonBuilder {
	company := builder.GetStructLike(b, Company{}).(Company)
	company.AddDomain(value)
	return builder.Set(b, "Domains", company.Domains).(jsonBuilder)
}
Exemple #6
0
func (b jsonBuilder) AddPhoneNumber(value string, valueType string) jsonBuilder {
	customer := builder.GetStructLike(b, Customer{}).(Customer)
	customer.AddPhoneNumber(value, valueType)
	return builder.Set(b, "PhoneNumbers", customer.PhoneNumbers).(jsonBuilder)
}
Exemple #7
0
func (b jsonBuilder) BuildNote() Note {
	note := builder.GetStructLike(b, Note{}).(Note)
	note.InitializeResource(note)
	return note
}
Exemple #8
0
func (b jsonBuilder) BuildNote() Note {
	return builder.GetStructLike(b, Note{}).(Note)
}
Exemple #9
0
func (b jsonBuilder) BuildCompany() Company {
	return builder.GetStructLike(b, Company{}).(Company)
}
Exemple #10
0
func (b jsonBuilder) BuildCase() Case {
	cas := builder.GetStructLike(b, Case{}).(Case)
	cas.InitializeResource(cas)
	return cas
}
Exemple #11
0
func (b jsonBuilder) BuildReply() Reply {
	rep := builder.GetStructLike(b, Reply{}).(Reply)
	rep.InitializeResource(rep)
	return rep
}
Exemple #12
0
func (b jsonBuilder) BuildMessage() Message {
	msg := builder.GetStructLike(b, Message{}).(Message)
	msg.InitializeResource(msg)
	return msg
}
Exemple #13
0
func (b jsonBuilder) BuildCustomer() Customer {
	cust := builder.GetStructLike(b, Customer{}).(Customer)
	cust.InitializeResource(cust)
	return cust
}
Exemple #14
0
func (b jsonBuilder) BuildJob() Job {
	jb := builder.GetStructLike(b, Job{}).(Job)
	jb.InitializeResource(jb)
	return jb
}
Exemple #15
0
func (b jsonBuilder) BuildCompany() Company {
	cmp := builder.GetStructLike(b, Company{}).(Company)
	cmp.InitializeResource(cmp)
	return cmp
}
Exemple #16
0
func (b jsonBuilder) BuildCase() Case {
	return builder.GetStructLike(b, Case{}).(Case)
}
Exemple #17
0
func (b jsonBuilder) BuildDraft() Draft {
	return builder.GetStructLike(b, Draft{}).(Draft)
}
Exemple #18
0
func (b jsonBuilder) AddEmail(value string, valueType string) jsonBuilder {
	customer := builder.GetStructLike(b, Customer{}).(Customer)
	customer.AddEmail(value, valueType)
	return builder.Set(b, "Emails", customer.Emails).(jsonBuilder)
}
Exemple #19
0
func (b jsonBuilder) AddAddress(value string, valueType string) jsonBuilder {
	customer := builder.GetStructLike(b, Customer{}).(Customer)
	customer.AddAddress(value, valueType)
	return builder.Set(b, "Addresses", customer.Addresses).(jsonBuilder)
}
Exemple #20
0
func (b jsonBuilder) BuildDraft() Draft {
	dra := builder.GetStructLike(b, Draft{}).(Draft)
	dra.InitializeResource(dra)
	return dra
}