Documentation ¶
Index ¶
- type AppHandlers
- func (ah *AppHandlers) HelloHandler(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandlers) TweetInsertHandler(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandlers) TweetUpdateAndSelectHandler(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandlers) TweetUpdateBatchDMLHandler(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandlers) TweetUpdateDMLAndSelectHandler(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandlers) TweetUpdateDMLHandler(w http.ResponseWriter, r *http.Request)
- func (ah *AppHandlers) TweetUpdateHandler(w http.ResponseWriter, r *http.Request)
- type Tweet
- type TweetInsertReq
- type TweetStore
- func (s *TweetStore) InsertChain(ctx context.Context, content string) ([]string, error)
- func (s *TweetStore) TableName() string
- func (s *TweetStore) UpdateAndSelect(ctx context.Context, id string) (int64, error)
- func (s *TweetStore) UpdateBatchDMLChain(ctx context.Context, ids []string, content string) ([]string, error)
- func (s *TweetStore) UpdateChain(ctx context.Context, ids []string, content string) error
- func (s *TweetStore) UpdateDMLAndSelect(ctx context.Context, id string) (int64, error)
- func (s *TweetStore) UpdateDMLChain(ctx context.Context, ids []string, content string) ([]string, error)
- type TweetUpdateAndSelectReq
- type TweetUpdateBatchDMLReq
- type TweetUpdateDMLAndSelectReq
- type TweetUpdateDMLReq
- type TweetUpdateReq
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 ¶
InsertChain is Mutation APIを利用して、複数RowのInsertを実行
func (*TweetStore) TableName ¶
func (s *TweetStore) TableName() string
func (*TweetStore) UpdateAndSelect ¶
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 ¶
UpdateChain is Mutation APIを利用して、複数RowのUpdateを実行
func (*TweetStore) UpdateDMLAndSelect ¶
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 TweetUpdateDMLAndSelectReq ¶
type TweetUpdateDMLAndSelectReq struct {
ID string `json:"id"`
}
type TweetUpdateDMLReq ¶
type TweetUpdateReq ¶
Click to show internal directories.
Click to hide internal directories.