domains

package
v0.0.0-...-f94728f Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package domains contains the types.

Package domains contains the types.

Package domains contains the types.

Index

Constants

This section is empty.

Variables

View Source
var YOLog = func(context.Context, string, ...interface{}) {}

YOLog provides the log func used by generated queries.

Functions

func LikeColumns

func LikeColumns() []string

func LikePrimaryKeys

func LikePrimaryKeys() []string

func LikeSummaryServerColumns

func LikeSummaryServerColumns() []string

func LikeSummaryServerPrimaryKeys

func LikeSummaryServerPrimaryKeys() []string

Types

type Exhibition

type Exhibition struct {
	ID            int
	Place         string
	Title         string
	TitleJa       string
	Description   string
	DescriptionJa string
}

Exhibition has the exhibition data.

func (*Exhibition) IsNode

func (*Exhibition) IsNode()

IsNode is marker for gqlgen.

type ExhibitionListRequest

type ExhibitionListRequest struct {
	Limit       int
	LastKnownID int // 前回リストで返した最後のEntityのID
}

ExhibitionListRequest provides option for ExhibitionRepo#List.

type ExhibitionListResp

type ExhibitionListResp struct {
	List        []*Exhibition
	LastKnownID int
	HasNext     bool
}

ExhibitionListResp provides response for ExhibitionRepo#List.

type ExhibitionRepo

type ExhibitionRepo interface {
	Get(ctx context.Context, ids ...int) ([]*Exhibition, error)
	List(ctx context.Context, req *ExhibitionListRequest) (*ExhibitionListResp, error)
}

ExhibitionRepo is basic operation unit for Exhibition.

func NewExhibitionRepo

func NewExhibitionRepo() (ExhibitionRepo, error)

NewExhibitionRepo returns new ExhibitionRepo.

type Like

type Like struct {
	UUID      string    `spanner:"Uuid" json:"Uuid"`           // Uuid
	SessionID int64     `spanner:"SessionId" json:"SessionId"` // SessionId
	UserUUID  string    `spanner:"UserUUID" json:"UserUUID"`   // UserUUID
	CreatedAt time.Time `spanner:"CreatedAt" json:"CreatedAt"` // CreatedAt
}

Like represents a row from 'Likes'.

func FindLike

func FindLike(ctx context.Context, db YORODB, uuid string) (*Like, error)

FindLike gets a Like by primary key

func (*Like) Delete

func (l *Like) Delete(ctx context.Context) *spanner.Mutation

Delete deletes the Like from the database.

func (*Like) Insert

func (l *Like) Insert(ctx context.Context) *spanner.Mutation

Insert returns a Mutation to insert a row into a table. If the row already exists, the write or transaction fails.

func (*Like) InsertOrUpdate

func (l *Like) InsertOrUpdate(ctx context.Context) *spanner.Mutation

InsertOrUpdate returns a Mutation to insert a row into a table. If the row already exists, it updates it instead. Any column values not explicitly written are preserved.

func (*Like) IsNode

func (*Like) IsNode()

IsNode is marker for gqlgen.

func (*Like) Update

func (l *Like) Update(ctx context.Context) *spanner.Mutation

Update returns a Mutation to update a row in a table. If the row does not already exist, the write or transaction fails.

func (*Like) UpdateColumns

func (l *Like) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Mutation, error)

UpdateColumns returns a Mutation to update specified columns of a row in a table.

type LikeRepo

type LikeRepo interface {
	Insert(ctx context.Context, like *Like) (*Like, error)
	BulkInsert(ctx context.Context, like []Like) ([]Like, error)
}

LikeRepo is basic operation unit for Like.

func NewFakeLikeRepo

func NewFakeLikeRepo() (LikeRepo, error)

NewFakeLikeRepo returns new LikeRepo.

func NewLikeRepo

func NewLikeRepo(spannerClient *spanner.Client) (LikeRepo, error)

NewLikeRepo returns new LikeRepo.

type LikeSummary

type LikeSummary struct {
	SessionID int
	Second    int64
	Likes     int
}

LikeSummary has the like summary per second for session.

type LikeSummaryListResp

type LikeSummaryListResp struct {
	List []*LikeSummary
}

LikeSummaryListResp has a list of like summary per second for session.

type LikeSummaryRepo

type LikeSummaryRepo interface {
	Insert(ctx context.Context, like *LikeSummaryServer) (*LikeSummaryServer, error)
	BulkInsert(ctx context.Context, like []*LikeSummaryServer) ([]*LikeSummaryServer, error)
	List(ctx context.Context, second int64) (*LikeSummaryListResp, error)
}

LikeSummaryRepo is basic operation unit for LikeSummary.

func NewFakeLikeSummaryRepo

func NewFakeLikeSummaryRepo() (LikeSummaryRepo, error)

NewFakeLikeSummaryRepo returns new LikeSummaryRepo.

func NewLikeSummaryRepo

func NewLikeSummaryRepo(spannerClient *spanner.Client) (LikeSummaryRepo, error)

NewLikeSummaryRepo returns new LikeSummaryRepo.

type LikeSummaryServer

type LikeSummaryServer struct {
	Second    int64     `spanner:"Second" json:"Second"`       // Second
	SessionID int64     `spanner:"SessionId" json:"SessionId"` // SessionId
	ServerID  string    `spanner:"ServerId" json:"ServerId"`   // ServerId
	Likes     int64     `spanner:"Likes" json:"Likes"`         // Likes
	CreatedAt time.Time `spanner:"CreatedAt" json:"CreatedAt"` // CreatedAt
}

LikeSummaryServer represents a row from 'LikeSummaryServers'.

func FindLikeSummaryServer

func FindLikeSummaryServer(ctx context.Context, db YORODB, second int64, sessionID int64, serverID string) (*LikeSummaryServer, error)

FindLikeSummaryServer gets a LikeSummaryServer by primary key

func (*LikeSummaryServer) Delete

func (lss *LikeSummaryServer) Delete(ctx context.Context) *spanner.Mutation

Delete deletes the LikeSummaryServer from the database.

func (*LikeSummaryServer) Insert

func (lss *LikeSummaryServer) Insert(ctx context.Context) *spanner.Mutation

Insert returns a Mutation to insert a row into a table. If the row already exists, the write or transaction fails.

func (*LikeSummaryServer) InsertOrUpdate

func (lss *LikeSummaryServer) InsertOrUpdate(ctx context.Context) *spanner.Mutation

InsertOrUpdate returns a Mutation to insert a row into a table. If the row already exists, it updates it instead. Any column values not explicitly written are preserved.

func (*LikeSummaryServer) Update

func (lss *LikeSummaryServer) Update(ctx context.Context) *spanner.Mutation

Update returns a Mutation to update a row in a table. If the row does not already exist, the write or transaction fails.

func (*LikeSummaryServer) UpdateColumns

func (lss *LikeSummaryServer) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Mutation, error)

UpdateColumns returns a Mutation to update specified columns of a row in a table.

type Movie

type Movie struct {
	ID        int
	URL       string
	SessionID int
	SpeakerID string
}

Movie has the movie data.

func (*Movie) IsNode

func (*Movie) IsNode()

IsNode is marker for gqlgen.

type MovieRepo

type MovieRepo interface {
	ListByMoviesBySessionID(ctx context.Context, sessionID int) ([]Movie, error)
	ListByMoviesBySpeakerID(ctx context.Context, speakerID string) ([]Movie, error)
}

MovieRepo is basic operation unit for Movie.

func NewMovieRepo

func NewMovieRepo() (MovieRepo, error)

NewMovieRepo returns new MovieRepo

type News

type News struct {
	ID        string
	Date      string
	Message   string
	MessageJa string
	Link      *string
}

News has the news data.

func (*News) IsNode

func (*News) IsNode()

IsNode is marker for gqlgen.

type NewsListRequest

type NewsListRequest struct {
	Limit       int
	LastKnownID string // 前回リストで返した最後のEntityのID
}

NewsListRequest provides option for NewsRepo#List.

type NewsListResp

type NewsListResp struct {
	List        []*News
	LastKnownID string
	HasNext     bool
}

NewsListResp provides response for NewsRepo#List.

type NewsRepo

type NewsRepo interface {
	List(ctx context.Context, req *NewsListRequest) (*NewsListResp, error)
}

NewsRepo is basic operation unit for News.

func NewNewsRepo

func NewNewsRepo() (NewsRepo, error)

NewNewsRepo returns new NewsRepo.

type Session

type Session struct {
	ID         int
	Type       string
	Place      string
	Title      string
	TitleJa    string
	StartTime  string
	EndTime    string
	Outline    string
	OutlineJa  string
	Lang       string
	Tags       []string
	Liked      int
	SpeakerIDs []string
	UpdatedAt  time.Time
}

Session has the session data.

func (*Session) IsNode

func (*Session) IsNode()

IsNode is marker for gqlgen.

type SessionListRequest

type SessionListRequest struct {
	Limit       int
	LastKnownID int // 前回リストで返した最後のEntityのID
}

SessionListRequest provides option for SessionRepo#List.

type SessionListResp

type SessionListResp struct {
	List        []*Session
	LastKnownID int
	HasNext     bool
}

SessionListResp provides response for SessionRepo#List.

type SessionRepo

type SessionRepo interface {
	Get(ctx context.Context, ids ...int) ([]*Session, error)
	GetBySpeakerIDs(ctx context.Context, speakerIDs ...string) ([][]*Session, error)
	List(ctx context.Context, req *SessionListRequest) (*SessionListResp, error)
	AddLiked(ctx context.Context, id int, delta int) (*Session, error)
}

SessionRepo is basic operation unit for Session.

func NewSessionRepo

func NewSessionRepo() (SessionRepo, error)

NewSessionRepo returns new SessionRepo.

type Slide

type Slide struct {
	ID        int
	Lang      string
	URL       string
	SessionID int
	SpeakerID string
}

Slide has the slide data.

func (*Slide) IsNode

func (*Slide) IsNode()

IsNode is marker for gqlgen.

type SlideRepo

type SlideRepo interface {
	ListBySessionID(ctx context.Context, sessionID int) ([]Slide, error)
	ListBySpeakerID(ctx context.Context, speakerID string) ([]Slide, error)
}

SlideRepo is basic operation unit for Slide.

func NewSlideRepo

func NewSlideRepo() (SlideRepo, error)

NewSlideRepo returns new SlideRepo.

type Speaker

type Speaker struct {
	ID         string
	Name       string
	NameJa     string
	Company    string
	Position   string
	PositionJa string
	Profile    string
	ProfileJa  string
	IconURL    string
	TwitterID  string
	GithubID   string
}

Speaker has the speaker data.

func (*Speaker) IsNode

func (*Speaker) IsNode()

IsNode is marker for gqlgen.

type SpeakerRepo

type SpeakerRepo interface {
	Get(ctx context.Context, ids ...string) ([]Speaker, error)
}

SpeakerRepo is basic operation unit for Speaker.

func NewSpeakerRepo

func NewSpeakerRepo() (SpeakerRepo, error)

NewSpeakerRepo returns new SpeakerRepo.

type YODB

type YODB interface {
	YORODB
}

YODB is the common interface for database operations.

type YORODB

type YORODB interface {
	ReadRow(ctx context.Context, table string, key spanner.Key, columns []string) (*spanner.Row, error)
	Read(ctx context.Context, table string, keys spanner.KeySet, columns []string) *spanner.RowIterator
	ReadUsingIndex(ctx context.Context, table, index string, keys spanner.KeySet, columns []string) (ri *spanner.RowIterator)
	Query(ctx context.Context, statement spanner.Statement) *spanner.RowIterator
}

YORODB is the common interface for database operations.

Jump to

Keyboard shortcuts

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