Esempio n. 1
0
func (attr *Int16) addInsert(columnName string, sets, values *[]string, args *pgx.QueryArgs) {
	switch attr.Status {
	case Present, Null:
		*sets = append(*sets, columnName)
		*values = append(*values, args.Append(attr))
	}
}
Esempio n. 2
0
func (attr *Bytes) addUpdate(columnName string, sets *[]string, args *pgx.QueryArgs) {
	switch attr.Status {
	case Present:
		*sets = append(*sets, columnName+"="+args.Append(attr.Value))
	case Null:
		*sets = append(*sets, columnName+"="+args.Append(nil))
	}
}
Esempio n. 3
0
func (attr *Bytes) addInsert(columnName string, sets, values *[]string, args *pgx.QueryArgs) {
	switch attr.Status {
	case Present:
		*sets = append(*sets, columnName)
		*values = append(*values, args.Append(attr.Value))
	case Null:
		*sets = append(*sets, columnName)
		*values = append(*values, args.Append(nil))
	}
}
Esempio n. 4
0
func TestQueryArgs(t *testing.T) {
	var qa pgx.QueryArgs

	for i := 1; i < 512; i++ {
		expectedPlaceholder := "$" + strconv.Itoa(i)
		placeholder := qa.Append(i)
		if placeholder != expectedPlaceholder {
			t.Errorf(`Expected qa.Append to return "%s", but it returned "%s"`, expectedPlaceholder, placeholder)
		}
	}
}
Esempio n. 5
0
func (attr *Int16) addUpdate(columnName string, sets *[]string, args *pgx.QueryArgs) {
	switch attr.Status {
	case Present, Null:
		*sets = append(*sets, columnName+"="+args.Append(attr))
	}
}