views

package
Version: v0.0.0-...-69a499a Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 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",
			"latitude",
			"longitude",
			"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",
			"latitude",
			"longitude",
			"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 of the last known location of the session
	Latitude *string
	// The longitude of the last known location of the session
	Longitude *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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL