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)) } }
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)) } }
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)) } }
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) } } }
func (attr *Int16) addUpdate(columnName string, sets *[]string, args *pgx.QueryArgs) { switch attr.Status { case Present, Null: *sets = append(*sets, columnName+"="+args.Append(attr)) } }