当前位置: 首页>>代码示例>>Golang>>正文


Golang pgx.WriteBuf类代码示例

本文整理汇总了Golang中github.com/flynn/flynn/Godeps/_workspace/src/github.com/jackc/pgx.WriteBuf的典型用法代码示例。如果您正苦于以下问题:Golang WriteBuf类的具体用法?Golang WriteBuf怎么用?Golang WriteBuf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WriteBuf类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Encode

func (b bytea) Encode(w *pgx.WriteBuf, oid pgx.Oid) error {
	if len(b) == 0 {
		w.WriteInt32(-1)
		return nil
	}
	w.WriteInt32(int32(len(b)))
	w.WriteBytes(b)
	return nil
}
开发者ID:justintung,项目名称:flynn,代码行数:9,代码来源:que.go

示例2: Encode

func (p NullPoint) Encode(w *pgx.WriteBuf, oid pgx.Oid) error {
	if !p.Valid {
		w.WriteInt32(-1)
		return nil
	}

	s := fmt.Sprintf("point(%v,%v)", p.X, p.Y)
	w.WriteInt32(int32(len(s)))
	w.WriteBytes([]byte(s))

	return nil
}
开发者ID:devick,项目名称:flynn,代码行数:12,代码来源:example_custom_type_test.go

示例3: Encode

func (n *coreEncoder) Encode(w *pgx.WriteBuf, oid pgx.Oid) error {
	w.WriteInt32(int32(2))
	w.WriteBytes([]byte("42"))
	return nil
}
开发者ID:josephwinston,项目名称:flynn,代码行数:5,代码来源:query_test.go


注:本文中的github.com/flynn/flynn/Godeps/_workspace/src/github.com/jackc/pgx.WriteBuf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。