internal

package
v0.0.0-...-e0046dd Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package internal contains internal storer code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbCommon

type DbCommon struct {
	ID          string  `db:"id" goqu:"skipupdate"`
	Name        string  `db:"name"`
	Description *string `db:"description"`
	*DbTimestamps
}

DbCommon is a struct that maps to common fields we use

func MakeDbCommon

func MakeDbCommon(id, name, desc string, timestamps *statusthingv1.Timestamps) (*DbCommon, error)

MakeDbCommon builds the minimum required common fields of all db records

type DbItem

type DbItem struct {
	*DbCommon
	StatusID *string `db:"status_id"`
}

DbItem represents a common representation of an statusthingv1.Item in a db

func DbItemFromProto

func DbItemFromProto(pbitem *statusthingv1.Item) (*DbItem, error)

DbItemFromProto creates a DbItem from a statusthingv1.Item

func (*DbItem) ToProto

func (s *DbItem) ToProto() (*statusthingv1.Item, error)

ToProto converts a DbItem to a statusthingv1.Item

type DbNote

type DbNote struct {
	ID       string `db:"id"`
	NoteText string `db:"note_text"`
	ItemID   string `db:"item_id"`
	*DbTimestamps
}

DbNote is a common representation of a statusthingv1.Note in a database

func DbNoteFromProto

func DbNoteFromProto(pbnote *statusthingv1.Note) (*DbNote, error)

DbNoteFromProto returns a DbNote from a statusthingv1.Note

func (*DbNote) ToProto

func (n *DbNote) ToProto() (*statusthingv1.Note, error)

ToProto returns a statusthingv1.Note from a DbNote

type DbProtoable

type DbProtoable interface {
	ToProto() (proto.Message, error)
}

DbProtoable is something that can convert a dbresult to a protobuf message

type DbStatus

type DbStatus struct {
	*DbCommon
	Color *string `db:"color"`
	Kind  *string `db:"kind"`
}

DbStatus represents a common representation of a statusthingv1.Status in a db

func DbStatusFromProto

func DbStatusFromProto(pbstatus *statusthingv1.Status) (*DbStatus, error)

DbStatusFromProto creates a DbStatus from a statusthingv1.Status

func (*DbStatus) ToProto

func (s *DbStatus) ToProto() (proto.Message, error)

ToProto converts a DbStatus to a statusthingv1.Status

type DbTimestamps

type DbTimestamps struct {
	Created uint64  `db:"created"`
	Updated uint64  `db:"updated"`
	Deleted *uint64 `db:"deleted"`
}

DbTimestamps represents a statusthingv1.Timestamps as a db record

func MakeDbTimestamps

func MakeDbTimestamps(timestamps *statusthingv1.Timestamps) (*DbTimestamps, error)

MakeDbTimestamps converts a DbTimestamps to a statusthingv1.Timestamps

type DbUser

type DbUser struct {
	ID           string  `db:"id" goqu:"skipupdate"`
	Username     string  `db:"username"`
	Password     string  `db:"password"`
	FirstName    *string `db:"first_name"`
	LastName     *string `db:"last_name"`
	EmailAddress *string `db:"email_address"`
	LastLogin    *uint64 `db:"last_login"`
	AvatarURL    *string `db:"avatar_url"`
	*DbTimestamps
}

DbUser represents a user stored in a database

func DbUserFromProto

func DbUserFromProto(pbuser *v1.User) (*DbUser, error)

DbUserFromProto creates a [DBUser] from a v1.User

func (*DbUser) ToProto

func (u *DbUser) ToProto() (proto.Message, error)

ToProto converts a v1.User to a [DBUser]

type ProtoStorer

type ProtoStorer interface {
	Insert(ctx context.Context, pb proto.Message) (proto.Message, error)
	Select(ctx context.Context, idval string) (proto.Message, error)
	Update(ctx context.Context, idval string, opts ...filters.FilterOption) error
	Delete(ctx context.Context, idval string) error
	Where(ctx context.Context, opts ...filters.FilterOption) ([]proto.Message, error)
}

ProtoStorer is something that can store protobuf messages Not sold on this yet - just needed to dump it

Jump to

Keyboard shortcuts

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