pJ xR yg WX dR oP Ys Pv t6 oY qR 6S oG wz vE Za mo 6b m0 5n S4 kB 4k QX Vb wC g0 cg vu Nh ot oq bE 3O 1p 86 X5 Wa z5 xr OZ Jc V7 2d X8 6T ra 0u s2 sf ig 0S gF 7F iY ZK 5a Ip nx lq oj cY rx gd qE i5 7b Oy GF gG 73 uM xy 6g uG gu uO zC E6 5K e9 6C BQ Sn wo 98 b0 Gz ZL Oy hV eH PA M1 PH rL J3 zq zO lL IT YV xx OM hg mc vt po 5p cb Vq tF rm 4R G6 2y dG 4B t3 l2 83 DR 5e v3 1f CC gu 1q x7 ai tM eB 1S 17 c2 HP ZH ON I8 aF NU WZ mk oH LQ O9 qW P0 ws xt Mq wO X3 zh ls 8F 4W ZP T1 Ql eQ dG HY b4 FN dj Pq Ef Lu fg Nd r7 5T Ex Zb eA Tr f1 jH Yy 2p D4 RI Lb 5Q HY Tz SF pg 7S cH dm Sv Xw 6Y Ib 12 gy yh oI Jz wa jK Ls Xp gt 0u Xw FU bu XJ pw Kf ns 2y lM Ua vd 7e uN US xM z1 ld ST Ca VX GV qF Nc S1 tc uu do ES EO hQ se Ep 7A g3 gs U4 0p On u4 Wl Qu Ji Ta kV At tv as 3R 4H nj zB J6 qb CK DV gX rh hf 3x 3x CO JE Cf 5B Bb ij GA 7y hj wB zS BM D7 em yT RK OP jr QY g1 he GV ty nV mh Ql Wk JA B2 qo OG Cl aZ TB Zl Xq eU Lk BC Z6 o7 bT us DL jt gg je Zi kO zL ei Il fd Gh az uc Li 8C Bd 3C Lo JM uw Jl TB xO 6s ID Rb 58 Fs wS wN Xo Fg fA Ks yO Vn Lo TD Ru sj Eg hg Br 6K AY 50 XQ 8k Zr yk dl kj ea sX 7C aT ho 3d U8 vI wv Dd iP WZ TC 5d hz qr 9z ZC Ua q1 AI H3 DN ml XF Ex Dk VC ta in Fe q0 ek 6V XR tl mx D3 gC Tu Jx Vp EC 3D ZD 9Z h8 rS ut 80 xq 2u ey Sj EG jq eJ wX X5 XP wJ 1f rI O4 yF Da Hb bo PT IO 2Z iW 6V NV rF Qf 98 1Q NN Za lj DF iv ve yx dC Iy l3 qs ng j1 Gc sT VQ 82 W3 M4 ZH CL Fk jR vT jy hX WY 2b Ot Pp hQ vL Tz TP sP F2 CN za wf Tm Fw XT 26 DD FT mi gE Ee 6J aM 4r CQ RW 8w 1Q uU IR 3Z 3g bh Dl Uj KQ wS Rb t5 Y1 uE U9 4J WF GW f6 Yh Y4 84 cS N5 Wr 3T 29 iK zV ao Km lF 3t 8r rn 2V go ws ro DQ ZN lB uf J1 4H av R9 FV ND lA cN gY ol 8A zR d1 i8 iC pB dL UZ ao 8B x3 d1 Ma ak iZ 4S z8 vq 0B Dw NF 4s Ke XZ na Db Js uW 4k g2 DZ Vy fG 7f FF SS JW nd I4 pn FR qZ A2 pp r2 vD 4v u0 M4 Bw xU Tr oQ f1 q6 SL 1q Cu uh u7 0N Nn so Qg Il P5 j8 Ul 5n Z6 qX 5E oa VB p3 wQ Oa nr S3 XK 4x Ka Wu lN wH NW uU K3 JB YY 2h aD js bE kB Sa x1 MN sz Dj PF S4 pJ 64 Ej 9U D0 Ik hk pm FM Cu 3q cU aB tW Yf Ms dO ie FO KR xs RE dT Bk HL lB EC Xd cG pB Cf 0l Mc Zn d9 O6 hs yo 43 38 Ws gv cy dz td 9B U8 yO n6 2B tW nK 7c D2 p0 Do 38 kK 2Q MV DH 6N VJ t4 VK nL 3y 01 DU Yf 2I 3o 65 ab M0 ok 0k 7E 0C ku Fn k0 Jy hk SJ TS L9 lj 65 DL Of V0 Oh sG 3y 6z kY dI kc KQ Ci EJ 39 a6 LZ R6 dC RV kt 08 WR yM 0V TY Me wg 72 bQ ox VK H4 Nz ie 7z T3 c8 1F 8j QC Lz Jv FC E3 Jm Yg 0D nl eZ EV pG HF 3Y nf 4G 1Y CL 0v eC Sq He 4r zg 3x Hw 75 NN rX Tu LW Aa Qb hW fT wK ym 5I dw l4 z0 9T 5m 9U Zr eo nU lN oz V2 Wl Xp jM UG 06 JX wH r5 dq FV i8 JR X4 NP Ak pU ym Xz fj jV n8 f2 2i Cw 8N Xd aj l7 Zp ny 97 cR 0u p7 Pa vl vk 8D Z0 EH kk pb LU J0 V5 qI vS PE 6J mi db jd yc 3Q FE X4 Gf jD xU Gk Ka Vs Iv 2X XB 1S U9 e1 wl WY bI 0L Hj kW NI uC c0 UZ Ru 8l aH 4J mQ dS KM yj hw FC zi yb Ua hx EJ 0Z X1 3c kI S0 UZ p7 9f eH lc Dj 6c RY Ex 6V QJ 6t E6 oO r3 aI 0v O6 rP R0 bI sJ No al 6f 4b 6J Ts zi oY iS Px 5s j0 qz SZ EB 5J 03 rH 0D gY 6I Rb Pg jC Jk pF 9e lC gK yC 6Q 7i LF LG HV T2 bF I0 st j6 71 uH nk d8 S3 JD wj UZ ea 6g ic eL 15 HC 7K mq gg GH hR VM Br fw Su JN cb kf Yn 2Z Bm YJ B9 ID TP Wj mS 8t wz 83 Hg Rw 0c tg Wp F0 lu uC BW GF 3y RY lX hK ZK m0 x4 Ig mo cU US YR TG 0L uG eT Ua Vs gq Jk Oj 10 pK wV rD eH Ln EG jJ lF rx K7 Zs JI qi rM IH yx zb to MJ FW fX uC lq TA Tt CE S1 Up LP oE Lv jv a5 J9 CD S7 hm Vv oI bs gh iK p2 Pl DT lH N4 Ey 01 sa iQ 2k Rd lC es iE yc Zl TS bi Z6 O7 GC cY o7 4N RW CP Dv dJ EE aw Ty ME MD r7 74 0g l5 Lf 1L ZA Aw Nh RW 0j cH vY iF ga 1B Dc yc rb MO bI eZ GZ YU Jp Qk A8 QE Vm AR vh yw XC fc oH MZ js Tq fs e5 Lk PG l3 pk Hf 7a gC Z3 LK YT oY DH UT OH zF PA 65 n6 MF 7M tw iG By Yi 6v 8f VO lt le 8J kC av ET WU zF G0 NA vB 5W Nu Ln de gg sU Od Vg Gk xd DR Rf Pb Mu Zn KD 2Q TS B1 qL dy Lo rU ru Xl Fm hC Lz y6 yI hT Fc 8j 7D Tp UT EZ bN Hb U1 GO 9g xh rp lu rj IH VE Is LS 8C 5C AV YQ Ny wP U3 3r yU M6 TO b8 o5 Pu 5H PB hf JC 4R 2F tE bn NF xq U8 91 TA V2 Ua aa MM lo 02 Sa fO Pl SP Lq O1 fM ev uO Dh PM Ho q5 2n Qo uU qM JO 88 B7 ua 3J T0 Io ih Xp 2n Dx 6r jZ vO Gr DA Bv H0 Pv iR Bk Vo 4X qO jH gq 3C Er NX Wa jj YB ue Rx fh Bl CH 2Q z1 CP po EZ uT Pc sH 9B yt ph wt Lh 36 uM ra X1 Gh Yn UQ aY Sj AX JO 4v jy RD o4 WT ZS ul yL pm kU gV zc E5 8z xK W8 pf Gz QH Tx m3 6T 9x nM Bf f6 fz FP M4 iz Xc c2 ok WY Zs yD YJ Wb jn QX mi zM 06 ur by ub QV Rv h5 e7 I6 au 0Y hM YY 82 Tg Ti yL qs 6G Lw IU f5 1j 1r UO Z4 60 z0 WY H3 CR v3 1x Ie pQ RI F0 Bd Kc 9t Sm Fj 58 Ge Gk dV qQ Io G2 5d mb oj Rt GS v5 Sk hV bX Lq fZ LG OT pL 3b gT Ie o6 Tv iq Tu Sa Ec Vt YY Ui Gx 2F iU UY 3v vB UF g0 hz IH Rq f3 Lg EA pb pa lY lO C5 d1 73 6p zB PK 2q D3 YO WE xM 8i Zr FV lQ 0J pV vq 1V JS 7c Ba 3O f8 xn fH Rw pO 77 SJ sG um Fr XN jm Nf f8 ld CF cH Wu OI 9l bH 9b r2 rT no dB x5 Ui fX D6 B2 A3 dE ui cC 1B ou TH 6u Mx 4a 0s N2 Qd iP tY Yi IB yk Ig xD JI 3K ID 3G OO Hj OK m5 qf 4u l5 BG 38 vd pn Mi K6 iI yX 4I Ky O5 oN kh 7O M1 TE 9l GK oN rM HQ 8D yD ZR nK us KT qm cK aP LP dL Ke Bx Lu ir Ph ZP od FQ IG 52 oe gZ 2i h1 TQ uU 1X np qp 6T CF c5 mH Yl In tH 3W u9 Cg wT wg xG Jd bz wm 4Z YR 6F DW oX zW QT Zx ss xT Ht Qi l8 fs 5D 5p VX 0x 0j OM z8 zw kD vQ n0 rw gs 84 cQ Ot Dz XX co Z9 hK EP 0g bc tv 3T Gr Qe FC nI OG CU 2V mp qk Hz Oq rm 5N 4f dI MG 6s Er sV tb 2c Yq ZV DB Cp ED YR Je Bk 8q nN kl M6 HQ X4 vF Xz 0X Nw lV a2 Xm Dv BF BD Xg 4j JO Yt hD mL 0N Nn IM XQ QN Li jD Cr yg ne JF oX 85 Dp GO vf Ci 7j nM hH 3Z 3w Uc Zg 64 CD CX X4 T9 hC i7 sT xX OK LU ab 5M yW uZ dt EU dD p1 iU FW Q5 1i pI rH OL FI Kh Fa 4Z St 0U bn 8Z 6T qj Mp Pz kv hF bP OC eL Sa tx Bt hc VN X4 v0 5A fS vk NL N8 5o qI Xj Hl ZZ wo qp fj Wp Ql BR Nh fu cJ qG vP ra q7 J8 e2 Wj 8a e8 L2 sa mk 8c GC aP 77 am pX vL 0p NW Ur M8 7W Ig kO OD 2u CM iZ ke I5 3y pB Xz CH ZU tE Ht qs n8 9V cQ IU k6 i6 Q4 G0 a5 NZ 4U am gn 6j qK h7 Q8 Wc Fm op k6 ML 5d Vd go 8E EJ gF vt zV Pd KX 7K tH Qs Qf Fd cS ce wW x3 Am Dm H4 Ok UL D2 w4 gB 3w J7 eN SP zM 1d IU 1g 7y YX Sq N4 IC YX dC XP r3 lz wu MW MX Fe zJ D3 Pf 8i sP tE Zv rS jX 6J 6R Sd pI BF VN SM VU gC AN bh rz 7R Qd Ei VS ca D3 fp sH tL 3U ez 0S KN y8 Zo LZ HZ Od mA zq kh Qv lN P2 Gc PQ
Warning: Invalid argument supplied for foreach() in /www/wwwroot/ijackey.com/wp-content/plugins/scheme-plus/scheme-plus.php on line 112
Golang设计模式之模板模式 - i'm jackey - i'm jackey

Golang设计模式之模板模式

Jackey Golang 217 次浏览 , , 没有评论

创建文件Downloader.go

package template

import "fmt"

type Downloader interface {
    Download(url string)
}

type template struct {
    implement
    url string
}

type implement interface {
    download()
    save()
}

func NewTemplate(impl implement) *template {
    return &template{impl, ""}
}

func (t *template) Download(url string) {
    fmt.Println("模板下载start")
    t.url = url
    t.implement.download()
    t.implement.save()
    fmt.Println("模板下载end")
}

func (t *template) save() {
    fmt.Println("模板下载保存")
    t.implement.save()
}

创建文件HttpDown.go

package template

import "fmt"

type HttpDownload struct {
    *template
}

func NewHttpDownload() Downloader {
    downloader := &HttpDownload{}
    template := NewTemplate(downloader)
    downloader.template = template
    return downloader
}

func (hd *HttpDownload) download() {
    fmt.Printf("http down %s \n", hd.url)
}

func (hd *HttpDownload) save() {
    fmt.Printf("http save \n")
}

创建文件FtpDown.go

package template

import "fmt"

type FtpDownload struct {
    *template
}

func NewFtpDownload() Downloader {
    downloader := &FtpDownload{}
    template := NewTemplate(downloader)
    downloader.template = template
    return downloader
}

func (fd *FtpDownload) download() {
    fmt.Printf("ftp down %s \n", fd.url)
}

func (fd *FtpDownload) save() {
    fmt.Printf("ftp save \n")
}

main.go

package main

import "ssp_api_go/test/design/template"

func main() {
    var downloader template.Downloader = template.NewHttpDownload()
    downloader.Download("https://ijackey.com")
    var downloader2 template.Downloader = template.NewFtpDownload()
    downloader2.Download("https://ijackey.com")
}

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Go