entity

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Id           string   `json:"id,omitempty"`
	RefIds       []string `json:"ref_ids,omitempty"`
	OwnerId      string   `json:"owner_id,omitempty"`
	Path         string   `json:"path,omitempty"` // private path of the resource
	Name         string   `json:"name,omitempty"` // name of the resource
	Url          string   `json:"url,omitempty"`  // public URL of the resource
	ContentType  string   `json:"content_type,omitempty"`
	ContentSize  int64    `json:"content_size,omitempty"`
	Description  string   `json:"description,omitempty"`
	Tags         []string `json:"tags,omitempty"` // meta data
	Ordering     int32    `json:"ordering,omitempty"`
	ImageDataUrl string   `json:"image_data_url,omitempty"` // image (thumbnail) data URL if applicable
	CreatedAt    string   `json:"created_at,omitempty"`
	Hash         string   `json:"hash,omitempty"` // hash of the attachment
}

func (*Attachment) CreatedTime

func (c *Attachment) CreatedTime() time.Time

func (*Attachment) ID

func (c *Attachment) ID() string

func (*Attachment) Namespace

func (c *Attachment) Namespace() string

func (*Attachment) RefIDs

func (c *Attachment) RefIDs() []string

func (*Attachment) URL

func (c *Attachment) URL() string

func (*Attachment) Validate

func (c *Attachment) Validate() *types.CommonError

func (*Attachment) WithCreatedTime

func (c *Attachment) WithCreatedTime(t time.Time) mycontent.Data

func (*Attachment) WithID

func (c *Attachment) WithID(id string) mycontent.Data

func (*Attachment) WithNamespace

func (c *Attachment) WithNamespace(id string) mycontent.Data

func (*Attachment) WithURL

func (c *Attachment) WithURL(url string) mycontent.Data

type File

type File struct {
	Id          string   `json:"id,omitempty"`
	RefIds      []string `json:"ref_ids,omitempty"`
	Url         string   `json:"url,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	OwnerId     string   `json:"owner_id,omitempty"`
	CreatedAt   string   `json:"created_at,omitempty"`
}

It's an upload config. It will be translated as attachment in the end.

type Image

type Image struct {
	Id             string         `json:"id,omitempty"`
	RefIds         []string       `json:"ref_ids,omitempty"`
	ThumbnailUrl   string         `json:"thumbnail_url,omitempty"` // smaller version of the image
	OffsetX        int32          `json:"offset_x,omitempty"`
	OffsetY        int32          `json:"offset_y,omitempty"`
	RatioX         int32          `json:"ratio_x,omitempty"` // will only crop if image width is higher
	RatioY         int32          `json:"ratio_y,omitempty"` // will only crop if image height is higher
	DataUrl        string         `json:"data_url,omitempty"`
	Url            string         `json:"url,omitempty"`             // full version of the image (can be different ratio)
	ScalePx        int32          `json:"scale_px,omitempty"`        // scale in px
	ScaleDirection ScaleDirection `json:"scale_direction,omitempty"` // either: "width" / "height"
	Description    string         `json:"description,omitempty"`
	Tags           []string       `json:"tags,omitempty"`
	Rotation       float64        `json:"rotation,omitempty"`
	CreatedAt      string         `json:"created_at,omitempty"`
	OwnerId        string         `json:"owner_id,omitempty"`
}

Image, a special type of attachment (have thumbnails and image display configuration) It's an upload config. It will be translated as attachment in the end.

type ScaleDirection

type ScaleDirection int32
var (
	SCALE_DIRECTION_HORIZONTAL ScaleDirection = 0
	SCALE_DIRECTION_VERTICAL   ScaleDirection = 1
)

Jump to

Keyboard shortcuts

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