api

package
v0.0.0-...-16e7fcc Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompanyRequest

type CompanyRequest struct {
	Name string `json:"name" binding:"required,min=1"`
}

type EntryRequest

type EntryRequest struct {
	UserID    int64      `json:"user_id" binding:"required,min=1"`
	StartTime time.Time  `json:"start_time" binding:"required,timestamp"`
	EndTime   *time.Time `json:"end_time" binding:"omitempty,timestamp"`
	Date      time.Time  `json:"date" binding:"required,timestamp"`
}

type PaginationRequest

type PaginationRequest struct {
	Offset int32 `form:"offset" binding:"min=0"`
	Limit  int32 `form:"limit,default=10" binding:"min=1,max=100"`
}

Pagination contains pagination request

type RequestWithID

type RequestWithID struct {
	ID int64 `uri:"id" binding:"required,min=1,max=9223372036854775807"`
}

RequestWithID is used for requests searching for a resource by ID

type Server

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

Server stores information about a server.

func NewServer

func NewServer(config config.Config, store db.Store) (*Server, error)

NewServer creates a new HTTP server and sets up routing.

func (*Server) Start

func (server *Server) Start(address string) error

Start runs a server on a given address.

type UserRequest

type UserRequest struct {
	// Required information
	Username  string    `json:"username" binding:"required,alphanum"`
	Name      string    `json:"name" binding:"required,min=1"`
	Surname   string    `json:"surname" binding:"required,min=1"`
	Email     string    `json:"email" binding:"required,email"`
	BirthDate time.Time `json:"birth_date" binding:"required,lt"`
	Gender    string    `json:"gender" binding:"omitempty,gender"`
	Language  string    `json:"language" binding:"omitempty,language"`
	Timezone  string    `json:"timezone" binding:"omitempty"`
	// Optional user information
	Country *string `json:"country,omitempty" binding:"omitempty,len=2,ascii"`
	// Foreign keys
	CompanyID *int64 `json:"company_id"`
	ManagerID *int64 `json:"manager_id"`
	TeamID    *int64 `json:"team_id"`
}

Jump to

Keyboard shortcuts

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