model

package
v0.0.0-...-b99263a Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is the domain model for cache service

type Course

type Course struct {
	Id   int
	Name string
}

Course is created to show the project layout and courseDataServiceFactory, no real use.

type User

type User struct {
	Id         int       `json:"uid"`
	Name       string    `json:"username"`
	Department string    `json:"department"`
	Created    time.Time `json:"created"`
}

User has a name, department and created date. Name and created are required, department is optional. Id is auto-generated by database after the user is persisted. json is for couchdb

func (User) Validate

func (u User) Validate() error

Validate validates a newly created user, which has not persisted to database yet, so Id is empty

func (User) ValidatePersisted

func (u User) ValidatePersisted() error

ValidatePersisted validate a user that has been persisted to database, basically Id is not empty

Jump to

Keyboard shortcuts

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