Skip to content

Instantly share code, notes, and snippets.

View silenceper's full-sized avatar
🎯
Focusing

silenceper silenceper

🎯
Focusing
View GitHub Profile
@silenceper
silenceper / ent-transactions.go
Created November 5, 2020 03:06
ent-transactions-best-practices
// WithTx 通过WithTx进行事物操作,helper 方法
func WithTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error {
tx, err := client.Tx(ctx)
if err != nil {
return err
}
defer func() {
if v := recover(); v != nil {
tx.Rollback()
panic(v)
@silenceper
silenceper / git alias
Last active September 17, 2020 05:51
git alias
g=git
ga='git add'
gaa='git add --all'
gapa='git add --patch'
gb='git branch'
gba='git branch -a'
gbd='git branch -d'
gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
gbl='git blame -b -w'
gbnm='git branch --no-merged'
@silenceper
silenceper / .vimrc
Last active December 13, 2016 03:38
" Vundle
" ---------------------------------------------------------------------------
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
package main
import "fmt"
func main(){
fmt.Println("躁动 😢")
}