tree

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserID

func GetUserID(tx *sqlx.Tx, tokenID mtid.MTID) (uid int64, err error)

Types

type MytokenEntry

type MytokenEntry struct {
	api.MytokenEntry `json:",inline"`
	ID               mtid.MTID         `json:"-"`
	ParentID         mtid.MTID         `db:"parent_id" json:"-"`
	RootID           mtid.MTID         `db:"root_id" json:"-"`
	Name             db.NullString     `json:"name,omitempty"`
	CreatedAt        unixtime.UnixTime `db:"created" json:"created"`
}

MytokenEntry holds the information of a MytokenEntry as stored in the database

func (*MytokenEntry) Root

func (ste *MytokenEntry) Root() bool

Root checks if this MytokenEntry is a root token

type MytokenEntryTree

type MytokenEntryTree struct {
	Token    MytokenEntry       `json:"token"`
	Children []MytokenEntryTree `json:"children,omitempty"`
}

MytokenEntryTree is a tree of MytokenEntry

func AllTokens

func AllTokens(tx *sqlx.Tx, tokenID mtid.MTID) (trees []MytokenEntryTree, err error)

func AllTokensForUser

func AllTokensForUser(tx *sqlx.Tx, uid int64) ([]MytokenEntryTree, error)

func TokenSubTree

func TokenSubTree(tx *sqlx.Tx, tokenID mtid.MTID) (MytokenEntryTree, error)

Jump to

Keyboard shortcuts

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