model

package
v2.4.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 2 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chocolate

type Chocolate struct {
	ID    string `json:"-"`
	Name  string `json:"name"`
	Taste string `json:"taste"`
}

Chocolate is the chocolate that a user consumes in order to get fat and happy

func (Chocolate) GetAttributes

func (s Chocolate) GetAttributes() map[string]interface{}

func (Chocolate) GetID

func (c Chocolate) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (*Chocolate) SetID

func (c *Chocolate) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

type User

type User struct {
	ID string `json:"-"`
	//rename the username field to user-name.
	Username      string       `json:"user-name"`
	PasswordHash  string       `json:"-"`
	Chocolates    []*Chocolate `json:"-"`
	ChocolatesIDs []string     `json:"-"`
	// contains filtered or unexported fields
}

User is a generic database user

func (*User) AddToManyIDs

func (u *User) AddToManyIDs(name string, IDs []string) error

AddToManyIDs adds some new sweets that a users loves so much

func (*User) DeleteToManyIDs

func (u *User) DeleteToManyIDs(name string, IDs []string) error

DeleteToManyIDs removes some sweets from a users because they made him very sick

func (User) GetAttributes

func (s User) GetAttributes() map[string]interface{}

func (User) GetID

func (u User) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (User) GetReferencedIDs

func (u User) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (User) GetReferencedStructs

func (u User) GetReferencedStructs() []jsonapi.MarshalIdentifier

GetReferencedStructs to satisfy the jsonapi.MarhsalIncludedRelations interface

func (User) GetReferences

func (u User) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*User) SetID

func (u *User) SetID(id string) error

SetID to satisfy jsonapi.UnmarshalIdentifier interface

func (*User) SetToManyReferenceIDs

func (u *User) SetToManyReferenceIDs(name string, IDs []string) error

SetToManyReferenceIDs sets the sweets reference IDs and satisfies the jsonapi.UnmarshalToManyRelations interface

Jump to

Keyboard shortcuts

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