models

package
v0.0.0-...-ae87ca3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YAML_SERIALIZATION_SEPARATOR = "---\n"
)

Variables

This section is empty.

Functions

func DeserializeAndUpdateSessionsFromYAML

func DeserializeAndUpdateSessionsFromYAML(buf *bytes.Buffer, sessions *[]Session) error

func DeserializeClientFromYAML

func DeserializeClientFromYAML(buf *bytes.Buffer, client *Client) error

func DeserializeSessionsFromYAML

func DeserializeSessionsFromYAML(buf *bytes.Buffer) (*[]Session, error)

func SerializeSessionsToCSV

func SerializeSessionsToCSV(sessions []Session) (*bytes.Buffer, error)

func SerializeSessionsToFullCSV

func SerializeSessionsToFullCSV(session []Session) (*bytes.Buffer, error)

func SerializeSessionsToYAML

func SerializeSessionsToYAML(sessions []Session) (*bytes.Buffer, error)

Types

type Client

type Client struct {
	Name     string `yaml:"name"`
	PPH      uint16 `yaml:"pph"`
	Currency string `yaml:"currency"`
}

func (*Client) Serialize

func (c *Client) Serialize() (*bytes.Buffer, error)

func (Client) String

func (c Client) String() string

type EditableSession

type EditableSession struct {
	ID        string `yaml:"id"`
	Client    string `yaml:"client"`
	Date      string `yaml:"date"`
	StartTime string `yaml:"start_time"`
	EndTime   string `yaml:"end_time"`
	Note      string `yaml:"note"`
}

func (EditableSession) ToSession

func (ed EditableSession) ToSession() (*Session, error)

type Session

type Session struct {
	ID     *uint32
	Client Client
	Start  *time.Time
	End    *time.Time
	Note   string
}

func (Session) Conflicts

func (s Session) Conflicts(session Session) bool

func (Session) Duration

func (s Session) Duration() string

func (Session) Earnings

func (s Session) Earnings() (float64, error)

func (Session) Equals

func (s Session) Equals(session Session) bool

func (Session) Finished

func (s Session) Finished() bool

func (Session) Matches

func (s Session) Matches(session Session) bool

func (Session) SerializeYAML

func (s Session) SerializeYAML() (*[]byte, error)

func (Session) Similar

func (s Session) Similar(session Session) bool

func (Session) String

func (s Session) String() string

Jump to

Keyboard shortcuts

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