views

package
v0.0.0-...-5f4f256 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllSessionsMap is a map of attribute names in result type AllSessions
	// indexed by view name.
	AllSessionsMap = map[string][]string{
		"default": []string{
			"currentSession",
			"otherSessions",
		},
	}
	// SessionMap is a map of attribute names in result type Session indexed by
	// view name.
	SessionMap = map[string][]string{
		"default": []string{
			"id",
			"userId",
			"lastUsed",
			"browser",
			"os",
			"ip",
			"location",
			"coordinates",
			"isMobile",
			"mapUrl",
		},
	}
	// SessionCollectionMap is a map of attribute names in result type
	// SessionCollection indexed by view name.
	SessionCollectionMap = map[string][]string{
		"default": []string{
			"id",
			"userId",
			"lastUsed",
			"browser",
			"os",
			"ip",
			"location",
			"coordinates",
			"isMobile",
			"mapUrl",
		},
	}
)

Functions

func ValidateAllSessions

func ValidateAllSessions(result *AllSessions) (err error)

ValidateAllSessions runs the validations defined on the viewed result type AllSessions.

func ValidateAllSessionsView

func ValidateAllSessionsView(result *AllSessionsView) (err error)

ValidateAllSessionsView runs the validations defined on AllSessionsView using the "default" view.

func ValidateSessionCollectionView

func ValidateSessionCollectionView(result SessionCollectionView) (err error)

ValidateSessionCollectionView runs the validations defined on SessionCollectionView using the "default" view.

func ValidateSessionView

func ValidateSessionView(result *SessionView) (err error)

ValidateSessionView runs the validations defined on SessionView using the "default" view.

Types

type AllSessions

type AllSessions struct {
	// Type to project
	Projected *AllSessionsView
	// View to render
	View string
}

AllSessions is the viewed result type that is projected based on a view.

type AllSessionsView

type AllSessionsView struct {
	CurrentSession *SessionView
	OtherSessions  SessionCollectionView
}

AllSessionsView is a type that runs validations on a projected type.

type SessionCollectionView

type SessionCollectionView []*SessionView

SessionCollectionView is a type that runs validations on a projected type.

type SessionView

type SessionView struct {
	// Unique unchanging session ID
	ID *string
	// ID of the user this session is for
	UserID *string
	// Time that this session was last used
	LastUsed *string
	// The browser and browser version connected with this session
	Browser *string
	// The OS of the system where this session was used
	Os *string
	// The last IP address where this session was used
	IP *string
	// A humanReadable string describing the last known location of the session
	Location *string
	// The latitude and longitude of the last known location of the session
	Coordinates *string
	// Whether the session was from a mobile device
	IsMobile *bool
	// The URL of the Google map to show the location, suitable for using in an img
	// tag
	MapURL *string
}

SessionView is a type that runs validations on a projected type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL