Curated list of Go design patterns, recipes and idioms - GitHub

文章推薦指數: 80 %
投票人數:10人

Go Patterns build-status awesome license · Creational Patterns · Structural Patterns · Behavioral Patterns · Synchronization Patterns · Concurrency Patterns ... Skiptocontent {{message}} tmrts / go-patterns Public Notifications Star 17.8k Fork 1.6k CuratedlistofGodesignpatterns,recipesandidioms tmrts.com/go-patterns Apache-2.0License 17.8k stars 1.6k forks Star Notifications Code Issues 14 Pullrequests 46 Actions Projects 0 Security Insights More Code Issues Pullrequests Actions Projects Security Insights master Branches Tags Couldnotloadbranches Nothingtoshow Loading {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default Loading 2 branches 0 tags Code Loading Latestcommit LinMAD andtmrts structural/proxy:implementstructuralproxypattern(#27) … f978e42 Jul19,2017 structural/proxy:implementstructuralproxypattern(#27) *UpdategitignoreaddedJetBrains,LiteIDEandotherexcludefiles *Addedexampleofproxyrealisation *Updateproxydescriptionwithsimpleexample *Updateshowcasewithdescription,smallrefactoreofcode *Updateproxydoc *Addedcommentsinexampleproxyalsoaddedlinktogoplaysandbox *Smallimprovementofproxyexample *Updatelinkforplaygolang *Correctedmistakes,spliteduservalidationinproxy *Updatedlinktoplaygolangandsomemistakes f978e42 Gitstats 72 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime behavioral fixstategy.mdmarkdown Apr28,2017 concurrency concurrency/generator:useinclusiverangeiniteration Mar8,2017 creational creational/builder:implementthebuilderpattern Feb22,2017 idiom idiom/functional-options:fixformattingandnaming Sep6,2016 messaging messaging/publish-subscribe:fixchannelread Sep20,2016 profiling profiling/timing:elaborateondeferredfunctionevaluation Feb27,2017 stability stability/circuit-breaker:fixbrokenlink Oct20,2016 structural structural/proxy:implementstructuralproxypattern(#27) Jul19,2017 synchronization Rewritesemaphorepattern Apr16,2016 .gitignore structural/proxy:implementstructuralproxypattern(#27) Jul19,2017 .travis.yml travis-ci:configurecontinuousdeployments Oct20,2016 CONTRIBUTING.md CONTRIBUTING:extendthecontributionguidelines Sep6,2016 LICENSE LICENSE:removetheappendixattheendofthelicense Feb22,2017 README.md structural/proxy:implementstructuralproxypattern(#27) Jul19,2017 SUMMARY.md *:removepatterncategory"other" Feb22,2017 book.json SUMMARY:indexpatternsections Sep13,2016 gopher.png *:polishthelogo Mar6,2017 Viewcode GoPatterns CreationalPatterns StructuralPatterns BehavioralPatterns SynchronizationPatterns ConcurrencyPatterns MessagingPatterns StabilityPatterns ProfilingPatterns Idioms Anti-Patterns README.md GoPatterns Acuratedcollectionofidiomaticdesign&applicationpatternsforGolanguage. CreationalPatterns Pattern Description Status AbstractFactory Providesaninterfaceforcreatingfamiliesofreleatedobjects ✘ Builder Buildsacomplexobjectusingsimpleobjects ✔ FactoryMethod Defersinstantiationofanobjecttoaspecializedfunctionforcreatinginstances ✔ ObjectPool Instantiatesandmaintainsagroupofobjectsinstancesofthesametype ✔ Singleton Restrictsinstantiationofatypetooneobject ✔ StructuralPatterns Pattern Description Status Bridge Decouplesaninterfacefromitsimplementationsothatthetwocanvaryindependently ✘ Composite Encapsulatesandprovidesaccesstoanumberofdifferentobjects ✘ Decorator Addsbehaviortoanobject,staticallyordynamically ✔ Facade UsesonetypeasanAPItoanumberofothers ✘ Flyweight Reusesexistinginstancesofobjectswithsimilar/identicalstatetominimizeresourceusage ✘ Proxy Providesasurrogateforanobjecttocontrolit'sactions ✔ BehavioralPatterns Pattern Description Status ChainofResponsibility Avoidscouplingasendertoreceiverbygivingmorethanobjectachancetohandletherequest ✘ Command Bundlesacommandandargumentstocalllater ✘ Mediator Connectsobjectsandactsasaproxy ✘ Memento Generateanopaquetokenthatcanbeusedtogobacktoapreviousstate ✘ Observer Provideacallbackfornotificationofevents/changestodata ✔ Registry Keeptrackofallsubclassesofagivenclass ✘ State Encapsulatesvaryingbehaviorforthesameobjectbasedonitsinternalstate ✘ Strategy Enablesanalgorithm'sbehaviortobeselectedatruntime ✔ Template Definesaskeletonclasswhichdeferssomemethodstosubclasses ✘ Visitor Separatesanalgorithmfromanobjectonwhichitoperates ✘ SynchronizationPatterns Pattern Description Status ConditionVariable Providesamechanismforthreadstotemporarilygiveupaccessinordertowaitforsomecondition ✘ Lock/Mutex Enforcesmutualexclusionlimitonaresourcetogainexclusiveaccess ✘ Monitor Combinationofmutexandconditionvariablepatterns ✘ Read-WriteLock Allowsparallelreadaccess,butonlyexclusiveaccessonwriteoperationstoaresource ✘ Semaphore Allowscontrollingaccesstoacommonresource ✔ ConcurrencyPatterns Pattern Description Status N-Barrier PreventsaprocessfromproceedinguntilallNprocessesreachtothebarrier ✘ BoundedParallelism Completeslargenumberofindependenttaskswithresourcelimits ✔ Broadcast Transfersamessagetoallrecipientssimultaneously ✘ Coroutines Subroutinesthatallowsuspendingandresumingexecutionatcertainlocations ✘ Generators Yieldsasequenceofvaluesoneatatime ✔ Reactor Demultiplexesservicerequestsdeliveredconcurrentlytoaservicehandleranddispatchesthemsyncronouslytotheassociatedrequesthandlers ✘ Parallelism Completeslargenumberofindependenttasks ✔ ProducerConsumer Separatestasksfromtaskexecutions ✘ MessagingPatterns Pattern Description Status Fan-In Funnelstaskstoaworksink(e.g.server) ✔ Fan-Out Distributestasksamongworkers(e.g.producer) ✔ Futures&Promises Actsasaplace-holderofaresultthatisinitiallyunknownforsynchronizationpurposes ✘ Publish/Subscribe Passesinformationtoacollectionofrecipientswhosubscribedtoatopic ✔ Push&Pull Distributesmessagestomultipleworkers,arrangedinapipeline ✘ StabilityPatterns Pattern Description Status Bulkheads Enforcesaprincipleoffailurecontainment(i.e.preventscascadingfailures) ✘ Circuit-Breaker Stopstheflowoftherequestswhenrequestsarelikelytofail ✔ Deadline Allowsclientstostopwaitingforaresponseoncetheprobabilityofresponsebecomeslow(e.g.afterwaiting10secondsforapagerefresh) ✘ Fail-Fast Checkstheavailabilityofrequiredresourcesatthestartofarequestandfailsiftherequirementsarenotsatisfied ✘ Handshaking Asksacomponentifitcantakeanymoreload,ifitcan't,therequestisdeclined ✘ Steady-State Foreveryservicethataccumulatesaresource,someotherservicemustrecyclethatresource ✘ ProfilingPatterns Pattern Description Status TimingFunctions Wrapsafunctionandlogstheexecution ✔ Idioms Pattern Description Status FunctionalOptions AllowscreatingcleanAPIswithsanedefaultsandidiomaticoverrides ✔ Anti-Patterns Pattern Description Status CascadingFailures Afailureinasystemofinterconnectedpartsinwhichthefailureofapartcausesadominoeffect ✘ About CuratedlistofGodesignpatterns,recipesandidioms tmrts.com/go-patterns Topics go golang awesome patterns idioms design-patterns design-patterns-for-humans Resources Readme License Apache-2.0License Releases Noreleasespublished Packages0 Nopackagespublished Contributors11 Languages Go 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?