GAE GO Datastore中最大的数据类型是什么?

huangapple go评论80阅读模式
英文:

Largest Datatype in GAE GO Datastore

问题

谷歌AppEngine Go数据存储中最大的数据类型是什么?我遇到了字符串类型的限制,只允许500个字符。谢谢!

英文:

What is the largest data type in google appengine go datastore. I come across a limitation in string type which is only permits 500 characters. Thank you!

答案1

得分: 3

使用[]byte,它可以存储最多1兆字节。您可以使用[]byte("Foo")将字符串转换为字节,并使用string()将字符串转换回来。

数据存储中允许的数据类型有:

  • 有符号整数(int、int8、int16、int32和int64),
  • 布尔值,
  • 字符串,
  • float32和float64,
  • 任何底层类型是上述预声明类型之一的类型,
  • *Key,
  • time.Time,
  • appengine.BlobKey,
  • []byte(长度最多为1兆字节),
  • 上述任何类型的切片。

如果您想存储更大的数据,比如大型图像,请改用Blobstore。它允许最多32兆字节的数据。

英文:

Use a []byte, it can store up to 1 megabyte. You can convert a string to a byte using []byte("Foo") and get the string back using string().

Allowed datatypes in the datastore:

- signed integers (int, int8, int16, int32 and int64),
- bool,
- string,
- float32 and float64,
- any type whose underlying type is one of the above predeclared types,
- *Key,
- time.Time,
- appengine.BlobKey,
- []byte (up to 1 megabyte in length),
- slices of any of the above.

If you want store larger data, like big images, use the Blobstore instead. Which allows data up to 32 megabytes.

huangapple
  • 本文由 发表于 2013年1月15日 01:56:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/14323901.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定