backend

package
v0.0.0-...-52036cc Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppHandlers

type AppHandlers struct {
	TweetStore *TweetStore
}

func (*AppHandlers) HelloHandler

func (ah *AppHandlers) HelloHandler(w http.ResponseWriter, r *http.Request)

func (*AppHandlers) TweetInsertHandler

func (ah *AppHandlers) TweetInsertHandler(w http.ResponseWriter, r *http.Request)

func (*AppHandlers) TweetUpdateAndSelectHandler

func (ah *AppHandlers) TweetUpdateAndSelectHandler(w http.ResponseWriter, r *http.Request)

func (*AppHandlers) TweetUpdateBatchDMLHandler

func (ah *AppHandlers) TweetUpdateBatchDMLHandler(w http.ResponseWriter, r *http.Request)

func (*AppHandlers) TweetUpdateDMLAndSelectHandler

func (ah *AppHandlers) TweetUpdateDMLAndSelectHandler(w http.ResponseWriter, r *http.Request)

func (*AppHandlers) TweetUpdateDMLHandler

func (ah *AppHandlers) TweetUpdateDMLHandler(w http.ResponseWriter, r *http.Request)

func (*AppHandlers) TweetUpdateHandler

func (ah *AppHandlers) TweetUpdateHandler(w http.ResponseWriter, r *http.Request)

type Tweet

type Tweet struct {
	ID             string `spanner:"Id"`
	Author         string
	Content        string
	Count          int64
	Favos          []string
	Sort           int64
	ShardCreatedAt int64
	CreatedAt      time.Time
	UpdatedAt      time.Time
	CommitedAt     time.Time
	SchemaVersion  int64
}

Tweet is TweetTable Row

type TweetInsertReq

type TweetInsertReq struct {
	Content string `json:"content"`
}

type TweetStore

type TweetStore struct {
	// contains filtered or unexported fields
}

func NewTweetStore

func NewTweetStore(sc *spanner.Client) *TweetStore

NewTweetStore is New TweetStore

func (*TweetStore) InsertChain

func (s *TweetStore) InsertChain(ctx context.Context, content string) ([]string, error)

InsertChain is Mutation APIを利用して、複数RowのInsertを実行

func (*TweetStore) TableName

func (s *TweetStore) TableName() string

func (*TweetStore) UpdateAndSelect

func (s *TweetStore) UpdateAndSelect(ctx context.Context, id string) (int64, error)

UpdateAndSelect is Mutation APIを利用して、Updateを間に強引に挟んでみると、反映されるのかな?

func (*TweetStore) UpdateBatchDMLChain

func (s *TweetStore) UpdateBatchDMLChain(ctx context.Context, ids []string, content string) ([]string, error)

UpdateBatchDMLChain is 複数のDMLを一度に実行するtx.BatchUpdate()のサンプル

func (*TweetStore) UpdateChain

func (s *TweetStore) UpdateChain(ctx context.Context, ids []string, content string) error

UpdateChain is Mutation APIを利用して、複数RowのUpdateを実行

func (*TweetStore) UpdateDMLAndSelect

func (s *TweetStore) UpdateDMLAndSelect(ctx context.Context, id string) (int64, error)

UpdateDMLAndSelect is DMLを利用してUpdateを行い、同じTxでReadをする

DMLはtx.Update()を呼んだ時点で実行されるので、同じTxの以降のReadで更新が反映される

func (*TweetStore) UpdateDMLChain

func (s *TweetStore) UpdateDMLChain(ctx context.Context, ids []string, content string) ([]string, error)

UpdateDMLChain is DMLを利用して、複数RowのUpdateを実行

type TweetUpdateAndSelectReq

type TweetUpdateAndSelectReq struct {
	ID string `json:"id"`
}

type TweetUpdateBatchDMLReq

type TweetUpdateBatchDMLReq struct {
	IDs     []string `json:"ids"`
	Content string   `json:"content"`
}

type TweetUpdateDMLAndSelectReq

type TweetUpdateDMLAndSelectReq struct {
	ID string `json:"id"`
}

type TweetUpdateDMLReq

type TweetUpdateDMLReq struct {
	IDs     []string `json:"ids"`
	Content string   `json:"content"`
}

type TweetUpdateReq

type TweetUpdateReq struct {
	IDs     []string `json:"ids"`
	Content string   `json:"content"`
}

Jump to

Keyboard shortcuts

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