model

package
v0.0.0-...-90c1064 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UsageTypeUpdate = UsageType("update")
	UsageTypeOpen   = UsageType("open")
)

Functions

func ListBucketNames

func ListBucketNames() ([]string, error)

listBuckets はバケット一覧を取得する

Types

type Bucket

type Bucket struct {
	BaseDir string
	Name    string
}

Bucket はローカルバケットを管理する構造体

func ListBuckets

func ListBuckets() ([]*Bucket, error)

func NewBucket

func NewBucket(name string) (*Bucket, error)

func (Bucket) IsLocalOnly

func (l Bucket) IsLocalOnly() bool

IsLocalOnly はローカル限定のバケット

func (Bucket) Path

func (l Bucket) Path() (string, error)

Path はローカルバケット毎のルートパスを取得する

type BucketRef

type BucketRef struct {
	Bucket *Bucket
}

type Client

type Client struct {
	WorkingDir string
}

TODO implement

type KVTag

type KVTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type OGImage

type OGImage struct {
	URL       string `json:"url"`
	SecureURL string `json:"secure_url"`
	Type      string `json:"type"` // Content-Type
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Alt       string `json:"alt"`
}

type ServerBucket

type ServerBucket struct {
	Sois []*SoiData `json:"sois"`
}

func (*ServerBucket) Hash

func (s *ServerBucket) Hash() (string, error)

func (*ServerBucket) String

func (s *ServerBucket) String() string

type SoiData

type SoiData struct {
	ID     int
	Name   string   `json:"name"`  // ファイル名
	Title  string   `json:"title"` // <title>属性
	Hash   string   `json:"hash"`
	Path   string   `json:"path"` // (<basepath{soiroot + bucket}> + <path> + <name>.json)
	URI    string   `json:"uri"`
	Tags   []string `json:"tags"`
	KVTags []KVTag  `json:"kv_tags"`
	Rate   float32  `json:"rate"`

	OGTitle       string    `json:"og_title"`
	OGURL         string    `json:"og_url"`
	OGType        string    `json:"og_type"`
	OGDescription string    `json:"og_description"`
	OGSiteName    string    `json:"og_site_name"`
	OGImages      []OGImage `json:"og_images"`

	NumViews      int        `json:"num_views"`     // ページを開いた回数
	NumReads      float32    `json:"num_reads"`     // ページを実際に読んだ回数(2回半なら0.5)
	Comprehension int        `json:"comprehension"` // 理解度 1 - 100
	CreatedAt     time.Time  `json:"created_at"`
	UsageLogs     []UsageLog `json:"usage_log"`
}

func (*SoiData) FilePath

func (s *SoiData) FilePath(basePath string) string

type UsageLog

type UsageLog struct {
	Type   UsageType `json:"type"`
	UsedAt time.Time `json:"used_at"`
}

type UsageType

type UsageType string

func GetUsageType

func GetUsageType(s string) (*UsageType, bool)

Jump to

Keyboard shortcuts

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