serializers

package
v0.0.0-...-7dc802a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryParams url.Values

QueryParams ...

Functions

This section is empty.

Types

type AnonSession

type AnonSession struct {
	ID string `jsonapi:"primary,session"`
}

AnonSession anon session data

func (sess AnonSession) JSONAPILinks() *jsonapi.Links

JSONAPILinks links for the session json

func (AnonSession) JSONAPIMeta

func (sess AnonSession) JSONAPIMeta() *jsonapi.Meta

JSONAPIMeta links for the session json

type AuthSession

type AuthSession struct {
	ID string `jsonapi:"primary,session"`
	// User *User  `jsonapi:"relation,user"`
	User *models.User `jsonapi:"relation,user"`
}

AuthSession authenticated user session data

func (sess AuthSession) JSONAPILinks() *jsonapi.Links

JSONAPILinks links for the session json

func (AuthSession) JSONAPIMeta

func (sess AuthSession) JSONAPIMeta() *jsonapi.Meta

JSONAPIMeta links for the authed session json

type User

type User struct {
	ID           int             `jsonapi:"primary,user" gorm:"primary_key"`
	FirstName    string          `jsonapi:"attr,first_name" json:"first_name"`
	LastName     string          `jsonapi:"attr,last_name" json:"last_name"`
	Email        string          `jsonapi:"attr,email" valid:"email"`
	LastSigninAt time.Time       `jsonapi:"attr,last_signin_at,iso8601"`
	CreatedAt    time.Time       `jsonapi:"attr,created_at,iso8601"`
	UpdatedAt    time.Time       `jsonapi:"attr,updated_at,iso8601"`
	Source       string          `jsonapi:"attr,source,omitempty" gorm:"-" sql:"-"`
	Token        string          `jsonapi:"attr,token,omitempty" gorm:"-" sql:"-"`
	URL          string          `gorm:"-" sql:"-" jsonapi:"attr,url,omitempty"`
	Roles        pq.StringArray  `jsonapi:"attr,roles"`
	CompanyID    int             `jsonapi:"attr,company_id,omitempty" json:"company_id"`
	Company      *models.Company `jsonapi:"relation,company,omitempty" gorm:"save_associations:false"`
	models.User
}

User user data structure for admin

func (User) JSONAPIMeta

func (u User) JSONAPIMeta() *jsonapi.Meta

JSONAPIMeta meta data

type Users

type Users []*User

Users admin users list serializer

func (i Users) JSONAPILinks() *jsonapi.Links

JSONAPILinks jsonapi links

func (Users) JSONAPIMeta

func (i Users) JSONAPIMeta() *jsonapi.Meta

JSONAPIMeta jsonapi meta

Jump to

Keyboard shortcuts

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