加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

golang的GAE环境下的appengine包

发布时间:2020-12-16 18:49:56 所属栏目:大数据 来源:网络整理
导读:package appengine import "code.google.com/p/appengine-go/appengine" appengine 包提供 Google App Engine 的基本函数服务。 更多细节参见:https://developers.google.com/appengine/docs/go/ Index type MultiError func (m MultiError) Error() string

package appengine

import "code.google.com/p/appengine-go/appengine"

appengine包提供Google App Engine的基本函数服务。

更多细节参见:https://developers.google.com/appengine/docs/go/

Index

  • type MultiError
    • func (m MultiError) Error() string
  • func IsCapabilityDisabled(err error) bool
  • func IsTimeoutError(err error) bool
  • func IsOverQuota(err error) bool
  • type GeoPoint
    • func (g GeoPoint) Valid() bool
  • type Context
    • func NewContext(req *http.Request) Context
    • func Namespace(c Context,namespace string) (Context,error)
    • func Timeout(c Context,d time.Duration) Context
  • type Certificate
  • func PublicCertificates(c Context) ([]Certificate,error)
  • func SignBytes(c Context,bytes []byte) (string,[]byte,error)
  • func IsDevAppServer() bool
  • func ServerSoftware() string
  • func VersionID(c Context) string
  • func AppID(c Context) string
  • func InstanceID() string
  • func RequestID(c Context) string
  • func Datacenter() string
  • func ServiceAccount(c Context) (string,error)
  • func DefaultVersionHostname(c Context) string
  • func ModuleName(c Context) string
  • func ModuleHostname(c Context,module,version,instance string) (string,error)
  • func AccessToken(c Context,scopes ...string) (token string,expiry time.Time,err error)
  • func BackendHostname(c Context,name string,index int) string
  • func BackendInstance(c Context) (name string,index int)
  • type BlobKey

typeMultiError

MutiError由批处理返回,包含每个条目的返回错误,错误一一对应与执行的条目,成功的条目对应的错误为nil

type MultiError []error

func (MultiError)Error

func (m MultiError) Error() string

funcIsCapabilityDisabled

func IsCapabilityDisabled(err error) bool

返回错误是否是因为API调用被禁止导致。

funcIsTimeoutError

func IsTimeoutError(err error) bool

返回错误是否是超时错误。

funcIsOverQuota

func IsOverQuota(err error) bool

返回错误是否是因为超出API服务的配额限制所导致。

typeGeoPoint

type GeoPoint struct { Lat,Lng float64 }

GeoPoint代表一个位置,使用经度值和维度值表示。

func (GeoPoint)Valid

func (g GeoPoint) Valid() bool

返回该位置是否合法,纬度值范围[-90,90],经度值返回[-180,180]

typeContext

type Context interface {
  // 将数据组织为字符串,并记录为Debug水平的日志
  Debugf(format string,args ...interface{})
  // 类似Debugf,记录为Info水平的日志
  Infof(format string,args ...interface{})
  // 类似Debugf,记录为Warning水平的日志
  Warningf(format string,args ...interface{})
  // 类似Debugf,记录为Error水平的日志
  Errorf(format string,args ...interface{})
  // 类似Debugf,记录为Critical水平的日志
  Criticalf(format string,args ...interface{})
  // 仅供内部使用
  Call(service,method string,in,out appengine_internal.ProtoMessage,opts *appengine_internal.CallOptions) error
  // 仅供内部使用,请使用AppID代替
  FullyQualifiedAppID() string
  // 仅供内部使用
  Request() interface{}
}

Context代表一个正在执行中的HTTP请求的上下文环境。

funcNewContext

func NewContext(req *http.Request) Context

返回正在运行中的HTTP请求Context,多次调用的返回值是相同的。

funcNamespace

func Namespace(c Context,namespace string) (Context,error)

返回一个在指定的命名空间内运行的替代用Context

funcTimeout

func Timeout(c Context,d time.Duration) Context

返回一个在指定的时间后超时的替代用Context

typeCertificate

type Certificate struct { KeyName string Data []byte // PEM编码X.509证书 }

Certificate代表一个app的公开证书。

funcPublicCertificates

func PublicCertificates(c Context) ([]Certificate,sans-serif;font-size:14px;background-color:#FFFFFF;"> 检索app的公证书,用于核实SignBytes返回的签名。 

funcSignBytes

func SignBytes(c Context,bytes []byte) (string,[]byte,sans-serif;font-size:14px;background-color:#FFFFFF;"> 使用你的app专有的一个私钥对数据进行签名。 

funcIsDevAppServer

func IsDevAppServer() bool

返回当前app是否运行在开发版本上。

funcServerSoftware

func ServerSoftware() string

返回当前appApp Engine版本,生产版本形如"Google App Engine/X.Y.Z",开发版本形如"Development/X.Y"

funcVersionID

func VersionID(c Context) string

返回当前app的版本ID,格式为"X.Y",其中Xapp.yaml指定的,而Y是在上传每次该版本app时累加的数字。

funcAppID

func AppID(c Context) string

返回当前appAppID

一般只返回ID("appid"),部署在自定义域名的会包含域名前缀("example.com:appid")

funcInstanceID

func InstanceID() string

返回当前实例的一个基本独有的识别码。

funcRequestID

func RequestID(c Context) string

返回当前请求的专有识别码。

funcDatacenter

func Datacenter() string

返回当前实例运作在数据中心的识别码。

funcDefaultVersionHostname

func DefaultVersionHostname(c Context) string

返回当前app默认版本的标准主机名(形如"my-app.appspot.com"),用于构造URL

funcServiceAccount

func ServiceAccount(c Context) (string,sans-serif;font-size:14px;background-color:#FFFFFF;"> 返回一个代表服务帐户名的字符串,采用email地址格式(app_id@appspot.gserviceaccount.com)

funcModuleName

func ModuleName(c Context) string

返回当前实例的模块名。

funcModuleHostname

func ModuleHostname(c Context,instance string) (string,sans-serif;font-size:14px;background-color:#FFFFFF;"> 返回一个模块实例的主机名,module为空的话,使用当前实例的模块,version为空则使用当前实例的版本(如不合法则使用当前实例的默认版本),如果实例为空,函数返回负载平衡主机名。 

funcAccessToken

func AccessToken(c Context,scopes ...string) (token string,expiry time.Time,err error)

生成一个代表当前app的服务帐户的指定作用域的Oauth2通行令牌,令牌会在时间超过expiry后过期。

funcBackendHostname

func BackendHostname(c Context,name string,index int) string

返回指定后端的标准主机名。如果index为-1,函数返回端主的负载平衡后机名。

funcBackendInstance

func BackendInstance(c Context) (name string,index int)

返回当前后端实例的名称和索引,如果不是后端实例,会返回"",-1。

typeBlobKey

type BlobKey string

BlobKeyblobstore的键的类型。定义在这里是为了避免blobstoredatastore的循环依赖。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读