models

package
v0.0.0-...-1011682 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Isu          Isu
	Timestamp    time.Time
	IsSitting    bool
	IsDirty      bool
	IsOverweight bool
	IsBroken     bool
	Message      string
	CreatedAt    time.Time
}

func NewCondition

func NewCondition(isu Isu) Condition

func NewConditionFromLastCondition

func NewConditionFromLastCondition(c Condition, durationMinute int) Condition

MEMO: random.baseTime を超えた時間が入る可能性がある

func (Condition) ConditionLevel

func (c Condition) ConditionLevel() ConditionLevel

func (Condition) Create

func (c Condition) Create() error

type ConditionLevel

type ConditionLevel int
const (
	ConditionLevelInfo     ConditionLevel = 1
	ConditionLevelWarning  ConditionLevel = 2
	ConditionLevelCritical ConditionLevel = 4
)

type Isu

type Isu struct {
	User        User
	JIAIsuUUID  string
	Name        string
	Image       []byte
	Character   string
	CharacterId int
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func NewIsu

func NewIsu(user User) Isu

func NewIsuWithCharacterId

func NewIsuWithCharacterId(user User, characterID int) Isu

func NewIsuWithCreatedAt

func NewIsuWithCreatedAt(user User, createdAt time.Time) Isu

func (Isu) Create

func (i Isu) Create() error

func (*Isu) WithUpdateImage

func (i *Isu) WithUpdateImage() error

func (*Isu) WithUpdateName

func (i *Isu) WithUpdateName() error

type IsuListById

type IsuListById map[string]JsonIsuInfo

type Json

type Json struct {
	JiaUserId   string      `json:"jia_user_id"`
	IsuListById IsuListById `json:"isu_list_by_id"`
}

type JsonArray

type JsonArray []*Json

func (*JsonArray) Commit

func (j *JsonArray) Commit() error

type JsonCondition

type JsonCondition struct {
	Timestamp      int64          `json:"timestamp"`
	IsSitting      bool           `json:"is_sitting"`
	IsDirty        bool           `json:"is_dirty"`
	IsOverweight   bool           `json:"is_overweight"`
	IsBroken       bool           `json:"is_broken"`
	Message        string         `json:"message"`
	CreatedAt      time.Time      `json:"created_at"`
	ConditionLevel ConditionLevel `json:"condition_level"`
}

type JsonConditions

type JsonConditions struct {
	Info     []JsonCondition `json:"info"`
	Warning  []JsonCondition `json:"warning"`
	Critical []JsonCondition `json:"critical"`
}

func (*JsonConditions) AddCondition

func (j *JsonConditions) AddCondition(condition Condition, isuId int) error

type JsonIsuInfo

type JsonIsuInfo struct {
	Id            int            `json:"id"`
	Name          string         `json:"name"`
	ImageFileHash [md5.Size]byte `json:"image_file_hash"`
	Character     string         `json:"character"`
	Conditions    JsonConditions `json:"conditions"`
	CreatedAt     time.Time      `json:"created_at"`
}

func ToJsonIsuInfo

func ToJsonIsuInfo(id int, isu Isu, conditions JsonConditions) JsonIsuInfo

type User

type User struct {
	JIAUserID string
	CreatedAt time.Time
}

func NewUser

func NewUser() User

func (User) Create

func (u User) Create() error

Jump to

Keyboard shortcuts

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