Skip to content

Commit

Permalink
Move other context types into context.go.
Browse files Browse the repository at this point in the history
  • Loading branch information
cassierecher committed Aug 20, 2021
1 parent f82f3d9 commit ce7aaf5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 16 additions & 0 deletions claat/types/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ import (
"time"
)

// Context is an export context.
// It is defined in this package so that it can be used by both cli and a server.
type Context struct {
Env string `json:"environment"` // Current export environment
Format string `json:"format"` // Output format, e.g. "html"
Prefix string `json:"prefix,omitempty"` // Assets URL prefix for HTML-based formats
MainGA string `json:"mainga,omitempty"` // Global Google Analytics ID
Updated *ContextTime `json:"updated,omitempty"` // Last update timestamp
}

// ContextMeta is a composition of export context and meta data.
type ContextMeta struct {
Context
Meta
}

// ContextTime is a wrapper around time.Time so we can implement JSON marshalling.
type ContextTime time.Time

Expand Down
16 changes: 0 additions & 16 deletions claat/types/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,6 @@ type Meta struct {
URL string `json:"url"` // Legacy ID; TODO: remove
}

// Context is an export context.
// It is defined in this package so that it can be used by both cli and a server.
type Context struct {
Env string `json:"environment"` // Current export environment
Format string `json:"format"` // Output format, e.g. "html"
Prefix string `json:"prefix,omitempty"` // Assets URL prefix for HTML-based formats
MainGA string `json:"mainga,omitempty"` // Global Google Analytics ID
Updated *ContextTime `json:"updated,omitempty"` // Last update timestamp
}

// ContextMeta is a composition of export context and meta data.
type ContextMeta struct {
Context
Meta
}

// Codelab is a top-level structure containing metadata and codelab steps.
type Codelab struct {
Meta
Expand Down

0 comments on commit ce7aaf5

Please sign in to comment.