model

package
v0.0.0-...-e4cdb90 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("resource not found")

Functions

func CloseDB

func CloseDB() error

func DeleteCommit

func DeleteCommit(ctx context.Context, pid, cid id.ID) error

func DeleteFile

func DeleteFile(ctx context.Context, pid, cid, fid id.ID) error

func DeleteProject

func DeleteProject(ctx context.Context, pid id.ID) error

func DeleteUser

func DeleteUser(ctx context.Context, uid id.ID) error

func InsertCommit

func InsertCommit(ctx context.Context, c *Commit) error

func InsertFile

func InsertFile(ctx context.Context, f *File) error

func InsertProject

func InsertProject(ctx context.Context, p *Project) error

func InsertUser

func InsertUser(ctx context.Context, u *User) error

func OpenDB

func OpenDB(dsn string) error

Types

type Commit

type Commit struct {
	ID       id.ID     `json:"id"`
	Title    string    `json:"title"`
	Message  string    `json:"message"`
	Created  time.Time `json:"created"`
	Modified time.Time `json:"modified"`

	Project id.ID `json:"projectID"`
	User    id.ID `json:"userID"`
}

func EditCommit

func EditCommit(ctx context.Context, pid, cid id.ID, modifyFn func(*Commit) error) (*Commit, error)

func GetAllCommits

func GetAllCommits(ctx context.Context, pid id.ID) ([]Commit, error)

func GetCommit

func GetCommit(ctx context.Context, pid, cid id.ID) (*Commit, error)

type File

type File struct {
	ID       id.ID     `json:"id"`
	Path     string    `json:"path"`
	Data     []byte    `json:"data"`
	Created  time.Time `json:"created"`
	Modified time.Time `json:"modified"`

	Commit  id.ID `json:"commitID"`
	Project id.ID `json:"projectID"`
}

func GetAllFiles

func GetAllFiles(ctx context.Context, pid, cid id.ID) ([]File, error)

func GetFile

func GetFile(ctx context.Context, pid, cid, fid id.ID) (*File, error)

func UpdateFile

func UpdateFile(ctx context.Context, pid, cid, fid id.ID, modifyFn func(*File) error) (*File, error)

type Project

type Project struct {
	ID          id.ID     `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Created     time.Time `json:"created"`
	Modified    time.Time `json:"modified"`

	Owner        id.ID   `json:"ownerID"`
	Contributors []id.ID `json:"contributors"`
}

func GetAllProjects

func GetAllProjects(ctx context.Context, uid id.ID) ([]Project, error)

func GetProject

func GetProject(ctx context.Context, pid id.ID) (*Project, error)

func UpdateProject

func UpdateProject(ctx context.Context, pid id.ID, modifyFn func(*Project) error) (*Project, error)

type User

type User struct {
	ID          id.ID     `json:"id"`
	DisplayName string    `json:"displayName"`
	Email       string    `json:"email"`
	Password    string    `json:"password,omitempty"`
	Created     time.Time `json:"created"`
	Modified    time.Time `json:"modified"`

	PasswdHash []byte `json:"-"`
	Salt       []byte `json:"-"`
}

func GetUser

func GetUser(ctx context.Context, id id.ID) (*User, error)

func GetUserByEmail

func GetUserByEmail(ctx context.Context, email string) (*User, error)

func UpdateUser

func UpdateUser(ctx context.Context, uid id.ID, modifyFn func(*User) error) (*User, error)

func (*User) Copy

func (u *User) Copy() *User

Jump to

Keyboard shortcuts

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