Beispiel #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)
	}
}
Beispiel #2
0
func (b jsonBuilder) BuildReply() Reply {
	return builder.GetStructLike(b, Reply{}).(Reply)
}
Beispiel #3
0
func (b jsonBuilder) BuildMessage() Message {
	return builder.GetStructLike(b, Message{}).(Message)
}
Beispiel #4
0
func (b jsonBuilder) BuildCustomer() Customer {
	return builder.GetStructLike(b, Customer{}).(Customer)
}
Beispiel #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)
}
Beispiel #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)
}
Beispiel #7
0
func (b jsonBuilder) BuildNote() Note {
	note := builder.GetStructLike(b, Note{}).(Note)
	note.InitializeResource(note)
	return note
}
Beispiel #8
0
func (b jsonBuilder) BuildNote() Note {
	return builder.GetStructLike(b, Note{}).(Note)
}
Beispiel #9
0
func (b jsonBuilder) BuildCompany() Company {
	return builder.GetStructLike(b, Company{}).(Company)
}
Beispiel #10
0
func (b jsonBuilder) BuildCase() Case {
	cas := builder.GetStructLike(b, Case{}).(Case)
	cas.InitializeResource(cas)
	return cas
}
Beispiel #11
0
func (b jsonBuilder) BuildReply() Reply {
	rep := builder.GetStructLike(b, Reply{}).(Reply)
	rep.InitializeResource(rep)
	return rep
}
Beispiel #12
0
func (b jsonBuilder) BuildMessage() Message {
	msg := builder.GetStructLike(b, Message{}).(Message)
	msg.InitializeResource(msg)
	return msg
}
Beispiel #13
0
func (b jsonBuilder) BuildCustomer() Customer {
	cust := builder.GetStructLike(b, Customer{}).(Customer)
	cust.InitializeResource(cust)
	return cust
}
Beispiel #14
0
func (b jsonBuilder) BuildJob() Job {
	jb := builder.GetStructLike(b, Job{}).(Job)
	jb.InitializeResource(jb)
	return jb
}
Beispiel #15
0
func (b jsonBuilder) BuildCompany() Company {
	cmp := builder.GetStructLike(b, Company{}).(Company)
	cmp.InitializeResource(cmp)
	return cmp
}
Beispiel #16
0
func (b jsonBuilder) BuildCase() Case {
	return builder.GetStructLike(b, Case{}).(Case)
}
Beispiel #17
0
func (b jsonBuilder) BuildDraft() Draft {
	return builder.GetStructLike(b, Draft{}).(Draft)
}
Beispiel #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)
}
Beispiel #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)
}
Beispiel #20
0
func (b jsonBuilder) BuildDraft() Draft {
	dra := builder.GetStructLike(b, Draft{}).(Draft)
	dra.InitializeResource(dra)
	return dra
}