Ejemplo 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))
	}
}
Ejemplo 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))
	}
}
Ejemplo 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))
	}
}
Ejemplo 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)
		}
	}
}
Ejemplo 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))
	}
}