model

package
v0.0.0-...-9067f3d Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package model defines common data structures used throughout the project.

The structs defined in this package are intended to be shared and referenced by multiple packages within the project. They represent common data entities, such as domain objects or data transfer objects, that are used across different layers or modules of the application. By centralizing these shared data structures in the model package, it helps to maintain consistency and reusability throughout the project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Errors

type Errors []error

Errors is a custom type created to enforce a specific set of values

func (Errors) Error

func (errs Errors) Error() string

type Event

type Event struct {
	ID        int64     `json:"id"`
	UUID      uuid.UUID `json:"uuid"`
	Type      EventType `json:"type"`
	Body      []byte    `json:"body"` // TODO change to map[string]interface{}?
	CreatedAt time.Time `json:"created_at"`
}

Event represents an immutable event that has occurred in the system.

type EventType

type EventType string

EventType is a custom type created to enforce a specific set of values that can be used to represent different types of events in the system.

const (
	LoggedIn       EventType = "logged_in"
	LoggedOut      EventType = "logged_out"
	LoggedOutAll   EventType = "logged_out_all"
	AccountCreated EventType = "account_created"
)

Values for EventType

type Session

type Session struct {
	ID        string    `json:"id"`
	UserID    uuid.UUID `json:"user_id"`
	CreatedAt time.Time `json:"created_at"`
}

Session represents a user session in the system.

type User

type User struct {
	ID       uuid.UUID `json:"id"`
	Username string    `json:"username"`
	Password string    `json:"password"`
}

User represents a user account.

func OmitPassword

func OmitPassword(user *User) *User

OmitPassword creates a copy of the user with the password field set to ""

Jump to

Keyboard shortcuts

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