English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The appengine package

## Introduction

Package appengine provides functionality that is common across App Engine APIs.

## Functions

func AppID

  `func AppID(c Context) string`

  AppID returns the application ID for the current application. The string will be a plain application ID (e.g. "appid"), with a domain prefix for custom domain deployments (e.g. "example.com:appid").

func BackendHostname

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

  BackendHostname returns the standard hostname of the specified backend. If index is -1, BackendHostname returns the load-balancing hostname for the backend.

func BackendInstance

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

  BackendInstance returns the name and index of the current backend instance, or "", -1 if this is not a backend instance.

func DefaultVersionHostname

  `func DefaultVersionHostname(c Context) string`

  DefaultVersionHostname returns the standard hostname of the default version of the current application (e.g. `http://your_app_id.appspot.com`). This is suitable for use in constructing URLs.

func IsDevAppServer

  `func IsDevAppServer() bool`

  IsDevAppServer reports whether the App Engine app is running in the development App Server.

func VersionID

  `func VersionID(c Context) string`

  VersionID returns the version ID for the current application. It will be of the form "X.Y", where X is specified in app.yaml, and Y is a number generated when each version of the app is uploaded.

## Types

type BlobKey

BlobKey is a key for a blobstore blob.

Conceptually, this type belongs in the blobstore package, but it lives in the appengine package to avoid a circular dependency: blobstore depends on datastore, and datastore needs to refer to the BlobKey type.

      type BlobKey string

type Context

Context represents the context of an in-flight HTTP request.

      type Context interface {
          // Debugf formats its arguments according to the format, analogous to fmt.Printf,
          // and records the text as a log message at Debug level.
          Debugf(format string, args ...interface{})

          // Infof is like Debugf, but at Info level.
          Infof(format string, args ...interface{})

          // Warningf is like Debugf, but at Warning level.
          Warningf(format string, args ...interface{})

          // Errorf is like Debugf, but at Error level.
          Errorf(format string, args ...interface{})

          // Criticalf is like Debugf, but at Critical level.
          Criticalf(format string, args ...interface{})
      }

  func NewContext

    `func NewContext(req *http.Request) Context`

    NewContext returns a new context for an in-flight HTTP request.